diff --git a/HEADER.txt b/HEADER.txt new file mode 100644 index 00000000..3ccbc930 --- /dev/null +++ b/HEADER.txt @@ -0,0 +1,13 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/AutoKeeperStatService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/AutoKeeperStatService.java index d84fa775..947a6f09 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/AutoKeeperStatService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/AutoKeeperStatService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollector.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollector.java index 6b64fbfd..b2bf2bad 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollector.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollector.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperData.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperData.java index 0d015e53..cc095e78 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperData.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper.impl; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperPersist.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperPersist.java index 58c65d52..5cc60509 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperPersist.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperPersist.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper.impl; /** diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperStatServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperStatServiceImpl.java index 67f23614..cd6b4ab8 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperStatServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperStatServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/DataSourceCreator.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/DataSourceCreator.java index d6469f73..72c79540 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/DataSourceCreator.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/DataSourceCreator.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/AlarmService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/AlarmService.java index 1bb238ed..98e7d2ea 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/AlarmService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/AlarmService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.alarm; import java.util.Map; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/DragoonAlarmService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/DragoonAlarmService.java index fdd6f76a..e6e39061 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/DragoonAlarmService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/alarm/DragoonAlarmService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.alarm; import java.util.Map; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/ArbitrateConfigImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/ArbitrateConfigImpl.java index 02ec3f25..803875a7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/ArbitrateConfigImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/ArbitrateConfigImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.arbitrate; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/DeadNodeListener.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/DeadNodeListener.java index a91d1d27..99c38136 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/DeadNodeListener.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/arbitrate/DeadNodeListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.arbitrate; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/basedao/GenericDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/basedao/GenericDAO.java index 6fe364a1..b748c8dc 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/basedao/GenericDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/basedao/GenericDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.basedao; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/baseservice/GenericService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/baseservice/GenericService.java index d37e5776..4f697af8 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/baseservice/GenericService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/baseservice/GenericService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.baseservice; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/ManagerException.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/ManagerException.java index f6a18f3b..54cbada2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/ManagerException.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/ManagerException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.exceptions; /** diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/RepeatConfigureException.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/RepeatConfigureException.java index 1c4b8316..912be1b0 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/RepeatConfigureException.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/common/exceptions/RepeatConfigureException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.common.exceptions; /** diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/AlarmRuleService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/AlarmRuleService.java index 6c7758c3..c4e0d3eb 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/AlarmRuleService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/AlarmRuleService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/AlarmRuleDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/AlarmRuleDAO.java index 6b233b14..349f4c30 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/AlarmRuleDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/AlarmRuleDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleDO.java index 84742ae2..2796fdc7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleParameter.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleParameter.java index 3018816a..7a0cacfb 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleParameter.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/dataobject/AlarmRuleParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/AlarmRuleParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/AlarmRuleParameterTypeHandler.java index 92eecd77..a2827044 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/AlarmRuleParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/AlarmRuleParameterTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/IbatisAlarmRuleDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/IbatisAlarmRuleDAO.java index bf3cc624..61c26cab 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/IbatisAlarmRuleDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/dal/ibatis/IbatisAlarmRuleDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.dal.ibatis; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/impl/AlarmRuleServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/impl/AlarmRuleServiceImpl.java index fba8d794..9f4c72d1 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/impl/AlarmRuleServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/alarm/impl/AlarmRuleServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.alarm.impl; import java.text.ParseException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/AutoKeeperClusterService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/AutoKeeperClusterService.java index c895e0f8..dc6a6920 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/AutoKeeperClusterService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/AutoKeeperClusterService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.autokeeper; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/AutoKeeperClusterDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/AutoKeeperClusterDAO.java index dec5564e..80c9eca9 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/AutoKeeperClusterDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/AutoKeeperClusterDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.autokeeper.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/dataobject/AutoKeeperClusterDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/dataobject/AutoKeeperClusterDO.java index 53fa74f5..5d666214 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/dataobject/AutoKeeperClusterDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/dataobject/AutoKeeperClusterDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.autokeeper.dal.dataobject; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/ibatis/IbatisAutoKeeperClusterDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/ibatis/IbatisAutoKeeperClusterDAO.java index 29810a15..86da32c2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/ibatis/IbatisAutoKeeperClusterDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/dal/ibatis/IbatisAutoKeeperClusterDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.autokeeper.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/impl/AutoKeeperClusterServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/impl/AutoKeeperClusterServiceImpl.java index fa26c3ae..48c4c4fb 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/impl/AutoKeeperClusterServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/autokeeper/impl/AutoKeeperClusterServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.autokeeper.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/CanalService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/CanalService.java index c9d6a4a8..bb2d7786 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/CanalService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/CanalService.java @@ -1,31 +1,45 @@ -package com.alibaba.otter.manager.biz.config.canal; - -import java.util.List; -import java.util.Map; - -import com.alibaba.otter.canal.instance.manager.model.Canal; - -/** - * @author sarah.lij 2012-7-25 下午04:02:20 - */ -public interface CanalService { - - public void create(Canal canal); - - public void remove(Long canalId); - - public void modify(Canal canal); - - public List listByIds(Long... identities); - - public List listAll(); - - public Canal findById(Long canalId); - - public Canal findByName(String name); - - public int getCount(Map condition); - - public List listByCondition(Map condition); - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal; + +import java.util.List; +import java.util.Map; + +import com.alibaba.otter.canal.instance.manager.model.Canal; + +/** + * @author sarah.lij 2012-7-25 下午04:02:20 + */ +public interface CanalService { + + public void create(Canal canal); + + public void remove(Long canalId); + + public void modify(Canal canal); + + public List listByIds(Long... identities); + + public List listAll(); + + public Canal findById(Long canalId); + + public Canal findByName(String name); + + public int getCount(Map condition); + + public List listByCondition(Map condition); + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/CanalDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/CanalDAO.java index 21885def..2fa55a1d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/CanalDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/CanalDAO.java @@ -1,12 +1,26 @@ -package com.alibaba.otter.manager.biz.config.canal.dal; - -import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; -import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; - -/** - * @author sarah.lij 2012-7-25 下午05:05:37 - */ -public interface CanalDAO extends GenericDAO { - - public CanalDO findByName(String name); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal.dal; + +import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; +import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; + +/** + * @author sarah.lij 2012-7-25 下午05:05:37 + */ +public interface CanalDAO extends GenericDAO { + + public CanalDO findByName(String name); +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/dataobject/CanalDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/dataobject/CanalDO.java index 1c7b04fe..0d301713 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/dataobject/CanalDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/dataobject/CanalDO.java @@ -1,82 +1,96 @@ -package com.alibaba.otter.manager.biz.config.canal.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import com.alibaba.otter.canal.instance.manager.model.CanalParameter; -import com.alibaba.otter.canal.instance.manager.model.CanalStatus; - -/** - * 类CanalDO.java的实现描述:TODO 类实现描述 - * - * @author sarah.lij 2012-7-25 下午05:11:18 - */ -public class CanalDO implements Serializable { - - private static final long serialVersionUID = 9148286590254926037L; - - private Long id; // 唯一标示id - private String name; // canal名字 - private String description; // 描述 - private CanalStatus status; - private CanalParameter parameters; // 参数定义 - private Date gmtCreate; // 创建时间 - private Date gmtModified; // 修改时间 - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public CanalStatus getStatus() { - return status; - } - - public void setStatus(CanalStatus status) { - this.status = status; - } - - public CanalParameter getParameters() { - return parameters; - } - - public void setParameters(CanalParameter parameters) { - this.parameters = parameters; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import com.alibaba.otter.canal.instance.manager.model.CanalParameter; +import com.alibaba.otter.canal.instance.manager.model.CanalStatus; + +/** + * 类CanalDO.java的实现描述:TODO 类实现描述 + * + * @author sarah.lij 2012-7-25 下午05:11:18 + */ +public class CanalDO implements Serializable { + + private static final long serialVersionUID = 9148286590254926037L; + + private Long id; // 唯一标示id + private String name; // canal名字 + private String description; // 描述 + private CanalStatus status; + private CanalParameter parameters; // 参数定义 + private Date gmtCreate; // 创建时间 + private Date gmtModified; // 修改时间 + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CanalStatus getStatus() { + return status; + } + + public void setStatus(CanalStatus status) { + this.status = status; + } + + public CanalParameter getParameters() { + return parameters; + } + + public void setParameters(CanalParameter parameters) { + this.parameters = parameters; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/CanalParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/CanalParameterTypeHandler.java index 566d7ef2..5f12ece6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/CanalParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/CanalParameterTypeHandler.java @@ -1,29 +1,43 @@ -package com.alibaba.otter.manager.biz.config.canal.dal.ibatis; - -import java.sql.SQLException; - -import com.alibaba.otter.canal.instance.manager.model.CanalParameter; -import com.alibaba.otter.shared.common.utils.JsonUtils; -import com.ibatis.sqlmap.client.extensions.ParameterSetter; -import com.ibatis.sqlmap.client.extensions.ResultGetter; -import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback; - -/** - * @author sarah.lij 2012-7-25 下午05:12:52 - */ -public class CanalParameterTypeHandler implements TypeHandlerCallback { - - @Override - public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { - setter.setString(JsonUtils.marshalToString(parameter)); - } - - @Override - public Object getResult(ResultGetter getter) throws SQLException { - return JsonUtils.unmarshalFromString(getter.getString(), CanalParameter.class); - } - - public Object valueOf(String s) { - return JsonUtils.unmarshalFromString(s, CanalParameter.class); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal.dal.ibatis; + +import java.sql.SQLException; + +import com.alibaba.otter.canal.instance.manager.model.CanalParameter; +import com.alibaba.otter.shared.common.utils.JsonUtils; +import com.ibatis.sqlmap.client.extensions.ParameterSetter; +import com.ibatis.sqlmap.client.extensions.ResultGetter; +import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback; + +/** + * @author sarah.lij 2012-7-25 下午05:12:52 + */ +public class CanalParameterTypeHandler implements TypeHandlerCallback { + + @Override + public void setParameter(ParameterSetter setter, Object parameter) throws SQLException { + setter.setString(JsonUtils.marshalToString(parameter)); + } + + @Override + public Object getResult(ResultGetter getter) throws SQLException { + return JsonUtils.unmarshalFromString(getter.getString(), CanalParameter.class); + } + + public Object valueOf(String s) { + return JsonUtils.unmarshalFromString(s, CanalParameter.class); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/IbatisCanalDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/IbatisCanalDAO.java index 0f282459..5f8eb11e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/IbatisCanalDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/dal/ibatis/IbatisCanalDAO.java @@ -1,69 +1,83 @@ -package com.alibaba.otter.manager.biz.config.canal.dal.ibatis; - -import java.util.List; -import java.util.Map; - -import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; - -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.manager.biz.config.canal.dal.CanalDAO; -import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; - -/** - * @author sarah.lij 2012-7-25 下午05:12:29 - */ -public class IbatisCanalDAO extends SqlMapClientDaoSupport implements CanalDAO { - - public CanalDO insert(CanalDO canal) { - Assert.assertNotNull(canal); - getSqlMapClientTemplate().insert("insertCanal", canal); - return canal; - } - - public void delete(Long canalId) { - Assert.assertNotNull(canalId); - getSqlMapClientTemplate().delete("deleteCanalById", canalId); - } - - public void update(CanalDO canal) { - Assert.assertNotNull(canal); - getSqlMapClientTemplate().update("updateCanal", canal); - } - - public List listAll() { - return (List) getSqlMapClientTemplate().queryForList("listCanals"); - } - - public List listByMultiId(Long... identities) { - List canalDos = getSqlMapClientTemplate().queryForList("listCanalByIds", identities); - return canalDos; - } - - public boolean checkUnique(CanalDO canal) { - int count = (Integer) getSqlMapClientTemplate().queryForObject("checkCanalUnique", canal); - return count == 0 ? true : false; - } - - public CanalDO findByName(String name) { - Assert.assertNotNull(name); - return (CanalDO) getSqlMapClientTemplate().queryForObject("findCanalByName", name); - } - - public CanalDO findById(Long identity) { - throw new UnsupportedOperationException(); - } - - public int getCount() { - return 0; - } - - public int getCount(Map condition) { - Integer count = (Integer) getSqlMapClientTemplate().queryForObject("getCanalCount", condition); - return count.intValue(); - } - - public List listByCondition(Map condition) { - List canalDos = getSqlMapClientTemplate().queryForList("listCanals", condition); - return canalDos; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal.dal.ibatis; + +import java.util.List; +import java.util.Map; + +import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; + +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.manager.biz.config.canal.dal.CanalDAO; +import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; + +/** + * @author sarah.lij 2012-7-25 下午05:12:29 + */ +public class IbatisCanalDAO extends SqlMapClientDaoSupport implements CanalDAO { + + public CanalDO insert(CanalDO canal) { + Assert.assertNotNull(canal); + getSqlMapClientTemplate().insert("insertCanal", canal); + return canal; + } + + public void delete(Long canalId) { + Assert.assertNotNull(canalId); + getSqlMapClientTemplate().delete("deleteCanalById", canalId); + } + + public void update(CanalDO canal) { + Assert.assertNotNull(canal); + getSqlMapClientTemplate().update("updateCanal", canal); + } + + public List listAll() { + return (List) getSqlMapClientTemplate().queryForList("listCanals"); + } + + public List listByMultiId(Long... identities) { + List canalDos = getSqlMapClientTemplate().queryForList("listCanalByIds", identities); + return canalDos; + } + + public boolean checkUnique(CanalDO canal) { + int count = (Integer) getSqlMapClientTemplate().queryForObject("checkCanalUnique", canal); + return count == 0 ? true : false; + } + + public CanalDO findByName(String name) { + Assert.assertNotNull(name); + return (CanalDO) getSqlMapClientTemplate().queryForObject("findCanalByName", name); + } + + public CanalDO findById(Long identity) { + throw new UnsupportedOperationException(); + } + + public int getCount() { + return 0; + } + + public int getCount(Map condition) { + Integer count = (Integer) getSqlMapClientTemplate().queryForObject("getCanalCount", condition); + return count.intValue(); + } + + public List listByCondition(Map condition) { + List canalDos = getSqlMapClientTemplate().queryForList("listCanals", condition); + return canalDos; + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/impl/CanalServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/impl/CanalServiceImpl.java index 3bd73791..ac23ce38 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/impl/CanalServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/canal/impl/CanalServiceImpl.java @@ -1,263 +1,277 @@ -package com.alibaba.otter.manager.biz.config.canal.impl; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.TransactionCallbackWithoutResult; -import org.springframework.transaction.support.TransactionTemplate; - -import com.alibaba.otter.canal.instance.manager.model.Canal; -import com.alibaba.otter.canal.instance.manager.model.CanalParameter; -import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; -import com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException; -import com.alibaba.otter.manager.biz.config.autokeeper.AutoKeeperClusterService; -import com.alibaba.otter.manager.biz.config.canal.CanalService; -import com.alibaba.otter.manager.biz.config.canal.dal.CanalDAO; -import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; -import com.alibaba.otter.manager.biz.config.node.impl.NodeServiceImpl; -import com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster; -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.shared.common.utils.JsonUtils; - -/** - * @author sarah.lij 2012-7-25 下午04:04:43 - */ -public class CanalServiceImpl implements CanalService { - - private static final Logger logger = LoggerFactory.getLogger(NodeServiceImpl.class); - - private CanalDAO canalDao; - private TransactionTemplate transactionTemplate; - private AutoKeeperClusterService autoKeeperClusterService; - - /** - * 添加 - */ - public void create(final Canal canal) { - Assert.assertNotNull(canal); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - CanalDO canalDO = modelToDo(canal); - canalDO.setId(0L); - if (!canalDao.checkUnique(canalDO)) { - String exceptionCause = "exist the same repeat canal in the database."; - logger.warn("WARN ## " + exceptionCause); - throw new RepeatConfigureException(exceptionCause); - } - canalDao.insert(canalDO); - canal.setId(canalDO.getId()); - } catch (RepeatConfigureException rce) { - throw rce; - } catch (Exception e) { - logger.error("ERROR ## create canal has an exception!"); - throw new ManagerException(e); - } - } - }); - } - - /** - * 删除 - */ - public void remove(final Long canalId) { - Assert.assertNotNull(canalId); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - canalDao.delete(canalId); - } catch (Exception e) { - logger.error("ERROR ## remove canal(" + canalId + ") has an exception!"); - throw new ManagerException(e); - } - } - }); - - } - - /** - * 修改 - */ - public void modify(final Canal canal) { - Assert.assertNotNull(canal); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - CanalDO canalDo = modelToDo(canal); - if (canalDao.checkUnique(canalDo)) { - canalDao.update(canalDo); - } else { - String exceptionCause = "exist the same repeat canal in the database."; - logger.warn("WARN ## " + exceptionCause); - throw new RepeatConfigureException(exceptionCause); - } - } catch (RepeatConfigureException rce) { - throw rce; - } catch (Exception e) { - logger.error("ERROR ## modify canal(" + canal.getId() + ") has an exception!"); - throw new ManagerException(e); - } - } - }); - - } - - public List listByIds(Long... identities) { - - List canals = new ArrayList(); - try { - List canalDos = null; - if (identities.length < 1) { - canalDos = canalDao.listAll(); - if (canalDos.isEmpty()) { - logger.debug("DEBUG ## couldn't query any canal, maybe hasn't create any canal."); - return canals; - } - } else { - canalDos = canalDao.listByMultiId(identities); - if (canalDos.isEmpty()) { - String exceptionCause = "couldn't query any canal by canalIds:" + Arrays.toString(identities); - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - } - canals = doToModel(canalDos); - } catch (Exception e) { - logger.error("ERROR ## query channels has an exception!"); - throw new ManagerException(e); - } - - return canals; - } - - public List listAll() { - return listByIds(); - } - - public Canal findById(Long canalId) { - Assert.assertNotNull(canalId); - List canals = listByIds(canalId); - if (canals.size() != 1) { - String exceptionCause = "query canalId:" + canalId + " return null."; - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - - return canals.get(0); - } - - public Canal findByName(String name) { - Assert.assertNotNull(name); - CanalDO canalDo = canalDao.findByName(name); - if (canalDo == null) { - String exceptionCause = "query name:" + name + " return null."; - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - - return doToModel(canalDo); - } - - @Override - public int getCount(Map condition) { - return canalDao.getCount(condition); - } - - @Override - public List listByCondition(Map condition) { - List canalDos = canalDao.listByCondition(condition); - if (canalDos.isEmpty()) { - logger.debug("DEBUG ## couldn't query any canal by the condition:" + JsonUtils.marshalToString(condition)); - return new ArrayList(); - } - - return doToModel(canalDos); - } - - /** - * 用于Model对象转化为DO对象 - * - * @param canal - * @return CanalDO - */ - private CanalDO modelToDo(Canal canal) { - CanalDO canalDo = new CanalDO(); - try { - canalDo.setId(canal.getId()); - canalDo.setName(canal.getName()); - canalDo.setStatus(canal.getStatus()); - canalDo.setDescription(canal.getDesc()); - canalDo.setParameters(canal.getCanalParameter()); - canalDo.setGmtCreate(canal.getGmtCreate()); - canalDo.setGmtModified(canal.getGmtModified()); - } catch (Exception e) { - logger.error("ERROR ## change the canal Model to Do has an exception"); - throw new ManagerException(e); - } - return canalDo; - } - - /** - * 用于DO对象转化为Model对象 - * - * @param canalDo - * @return Canal - */ - private Canal doToModel(CanalDO canalDo) { - Canal canal = new Canal(); - try { - canal.setId(canalDo.getId()); - canal.setName(canalDo.getName()); - canal.setStatus(canalDo.getStatus()); - canal.setDesc(canalDo.getDescription()); - CanalParameter parameter = canalDo.getParameters(); - AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(parameter.getZkClusterId()); - if (zkCluster != null) { - parameter.setZkClusters(Arrays.asList(StringUtils.join(zkCluster.getServerList(), ','))); - } - canal.setCanalParameter(canalDo.getParameters()); - canal.setGmtCreate(canalDo.getGmtCreate()); - canal.setGmtModified(canalDo.getGmtModified()); - } catch (Exception e) { - logger.error("ERROR ## change the canal Do to Model has an exception"); - throw new ManagerException(e); - } - - return canal; - } - - private List doToModel(List canalDos) { - List canals = new ArrayList(); - for (CanalDO canalDo : canalDos) { - canals.add(doToModel(canalDo)); - } - return canals; - } - - /* ------------------------setter / getter--------------------------- */ - - public void setCanalDao(CanalDAO canalDao) { - this.canalDao = canalDao; - } - - public void setTransactionTemplate(TransactionTemplate transactionTemplate) { - this.transactionTemplate = transactionTemplate; - } - - public void setAutoKeeperClusterService(AutoKeeperClusterService autoKeeperClusterService) { - this.autoKeeperClusterService = autoKeeperClusterService; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.canal.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; + +import com.alibaba.otter.canal.instance.manager.model.Canal; +import com.alibaba.otter.canal.instance.manager.model.CanalParameter; +import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; +import com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException; +import com.alibaba.otter.manager.biz.config.autokeeper.AutoKeeperClusterService; +import com.alibaba.otter.manager.biz.config.canal.CanalService; +import com.alibaba.otter.manager.biz.config.canal.dal.CanalDAO; +import com.alibaba.otter.manager.biz.config.canal.dal.dataobject.CanalDO; +import com.alibaba.otter.manager.biz.config.node.impl.NodeServiceImpl; +import com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster; +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.shared.common.utils.JsonUtils; + +/** + * @author sarah.lij 2012-7-25 下午04:04:43 + */ +public class CanalServiceImpl implements CanalService { + + private static final Logger logger = LoggerFactory.getLogger(NodeServiceImpl.class); + + private CanalDAO canalDao; + private TransactionTemplate transactionTemplate; + private AutoKeeperClusterService autoKeeperClusterService; + + /** + * 添加 + */ + public void create(final Canal canal) { + Assert.assertNotNull(canal); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + CanalDO canalDO = modelToDo(canal); + canalDO.setId(0L); + if (!canalDao.checkUnique(canalDO)) { + String exceptionCause = "exist the same repeat canal in the database."; + logger.warn("WARN ## " + exceptionCause); + throw new RepeatConfigureException(exceptionCause); + } + canalDao.insert(canalDO); + canal.setId(canalDO.getId()); + } catch (RepeatConfigureException rce) { + throw rce; + } catch (Exception e) { + logger.error("ERROR ## create canal has an exception!"); + throw new ManagerException(e); + } + } + }); + } + + /** + * 删除 + */ + public void remove(final Long canalId) { + Assert.assertNotNull(canalId); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + canalDao.delete(canalId); + } catch (Exception e) { + logger.error("ERROR ## remove canal(" + canalId + ") has an exception!"); + throw new ManagerException(e); + } + } + }); + + } + + /** + * 修改 + */ + public void modify(final Canal canal) { + Assert.assertNotNull(canal); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + CanalDO canalDo = modelToDo(canal); + if (canalDao.checkUnique(canalDo)) { + canalDao.update(canalDo); + } else { + String exceptionCause = "exist the same repeat canal in the database."; + logger.warn("WARN ## " + exceptionCause); + throw new RepeatConfigureException(exceptionCause); + } + } catch (RepeatConfigureException rce) { + throw rce; + } catch (Exception e) { + logger.error("ERROR ## modify canal(" + canal.getId() + ") has an exception!"); + throw new ManagerException(e); + } + } + }); + + } + + public List listByIds(Long... identities) { + + List canals = new ArrayList(); + try { + List canalDos = null; + if (identities.length < 1) { + canalDos = canalDao.listAll(); + if (canalDos.isEmpty()) { + logger.debug("DEBUG ## couldn't query any canal, maybe hasn't create any canal."); + return canals; + } + } else { + canalDos = canalDao.listByMultiId(identities); + if (canalDos.isEmpty()) { + String exceptionCause = "couldn't query any canal by canalIds:" + Arrays.toString(identities); + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + } + canals = doToModel(canalDos); + } catch (Exception e) { + logger.error("ERROR ## query channels has an exception!"); + throw new ManagerException(e); + } + + return canals; + } + + public List listAll() { + return listByIds(); + } + + public Canal findById(Long canalId) { + Assert.assertNotNull(canalId); + List canals = listByIds(canalId); + if (canals.size() != 1) { + String exceptionCause = "query canalId:" + canalId + " return null."; + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + + return canals.get(0); + } + + public Canal findByName(String name) { + Assert.assertNotNull(name); + CanalDO canalDo = canalDao.findByName(name); + if (canalDo == null) { + String exceptionCause = "query name:" + name + " return null."; + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + + return doToModel(canalDo); + } + + @Override + public int getCount(Map condition) { + return canalDao.getCount(condition); + } + + @Override + public List listByCondition(Map condition) { + List canalDos = canalDao.listByCondition(condition); + if (canalDos.isEmpty()) { + logger.debug("DEBUG ## couldn't query any canal by the condition:" + JsonUtils.marshalToString(condition)); + return new ArrayList(); + } + + return doToModel(canalDos); + } + + /** + * 用于Model对象转化为DO对象 + * + * @param canal + * @return CanalDO + */ + private CanalDO modelToDo(Canal canal) { + CanalDO canalDo = new CanalDO(); + try { + canalDo.setId(canal.getId()); + canalDo.setName(canal.getName()); + canalDo.setStatus(canal.getStatus()); + canalDo.setDescription(canal.getDesc()); + canalDo.setParameters(canal.getCanalParameter()); + canalDo.setGmtCreate(canal.getGmtCreate()); + canalDo.setGmtModified(canal.getGmtModified()); + } catch (Exception e) { + logger.error("ERROR ## change the canal Model to Do has an exception"); + throw new ManagerException(e); + } + return canalDo; + } + + /** + * 用于DO对象转化为Model对象 + * + * @param canalDo + * @return Canal + */ + private Canal doToModel(CanalDO canalDo) { + Canal canal = new Canal(); + try { + canal.setId(canalDo.getId()); + canal.setName(canalDo.getName()); + canal.setStatus(canalDo.getStatus()); + canal.setDesc(canalDo.getDescription()); + CanalParameter parameter = canalDo.getParameters(); + AutoKeeperCluster zkCluster = autoKeeperClusterService.findAutoKeeperClusterById(parameter.getZkClusterId()); + if (zkCluster != null) { + parameter.setZkClusters(Arrays.asList(StringUtils.join(zkCluster.getServerList(), ','))); + } + canal.setCanalParameter(canalDo.getParameters()); + canal.setGmtCreate(canalDo.getGmtCreate()); + canal.setGmtModified(canalDo.getGmtModified()); + } catch (Exception e) { + logger.error("ERROR ## change the canal Do to Model has an exception"); + throw new ManagerException(e); + } + + return canal; + } + + private List doToModel(List canalDos) { + List canals = new ArrayList(); + for (CanalDO canalDo : canalDos) { + canals.add(doToModel(canalDo)); + } + return canals; + } + + /* ------------------------setter / getter--------------------------- */ + + public void setCanalDao(CanalDAO canalDao) { + this.canalDao = canalDao; + } + + public void setTransactionTemplate(TransactionTemplate transactionTemplate) { + this.transactionTemplate = transactionTemplate; + } + + public void setAutoKeeperClusterService(AutoKeeperClusterService autoKeeperClusterService) { + this.autoKeeperClusterService = autoKeeperClusterService; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/ChannelService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/ChannelService.java index bff47487..58abf847 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/ChannelService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/ChannelService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ChannelDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ChannelDAO.java index 3f2222f7..8332d759 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ChannelDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ChannelDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/dataobject/ChannelDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/dataobject/ChannelDO.java index cac206da..ab843227 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/dataobject/ChannelDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/dataobject/ChannelDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/ChannelParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/ChannelParameterTypeHandler.java index d425b92c..a3389fe2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/ChannelParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/ChannelParameterTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/IbatisChannelDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/IbatisChannelDAO.java index 6dc2336d..4859d7fb 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/IbatisChannelDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/dal/ibatis/IbatisChannelDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/impl/ChannelServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/impl/ChannelServiceImpl.java index eb116c0f..2843fe57 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/impl/ChannelServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/channel/impl/ChannelServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.channel.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairGroupService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairGroupService.java index 7f8656f4..b647904a 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairGroupService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairGroupService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairService.java index 7d8a9a43..af0f332d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/DataColumnPairService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairDAO.java index 3ebe6949..23a92b8e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairGroupDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairGroupDAO.java index f9d8fa1b..37a05e53 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairGroupDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/DataColumnPairGroupDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairDO.java index 97e6d9be..b688faa4 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairGroupDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairGroupDO.java index 7c872172..848fbf26 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairGroupDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/dataobject/DataColumnPairGroupDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairDAO.java index d274efec..43bb5825 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairGroupDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairGroupDAO.java index 8c2e332c..10463cfd 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairGroupDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/dal/ibatis/IbatisDataColumnPairGroupDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairGroupServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairGroupServiceImpl.java index 285be7dc..bedb0ed0 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairGroupServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairGroupServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairServiceImpl.java index 62aeb4e3..e927104d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datacolumnpair/impl/DataColumnPairServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datacolumnpair.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/DataMatrixService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/DataMatrixService.java index b0543cec..e2ad2354 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/DataMatrixService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/DataMatrixService.java @@ -1,28 +1,42 @@ -package com.alibaba.otter.manager.biz.config.datamatrix; - -import java.util.List; -import java.util.Map; - -import com.alibaba.otter.shared.common.model.config.data.DataMatrix; - -public interface DataMatrixService { - - public void create(DataMatrix DataMatrix); - - public void remove(Long DataMatrixId); - - public void modify(DataMatrix DataMatrix); - - public List listByIds(Long... identities); - - public List listAll(); - - public DataMatrix findById(Long DataMatrixId); - - public DataMatrix findByGroupKey(String name); - - public int getCount(Map condition); - - public List listByCondition(Map condition); - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.datamatrix; + +import java.util.List; +import java.util.Map; + +import com.alibaba.otter.shared.common.model.config.data.DataMatrix; + +public interface DataMatrixService { + + public void create(DataMatrix DataMatrix); + + public void remove(Long DataMatrixId); + + public void modify(DataMatrix DataMatrix); + + public List listByIds(Long... identities); + + public List listAll(); + + public DataMatrix findById(Long DataMatrixId); + + public DataMatrix findByGroupKey(String name); + + public int getCount(Map condition); + + public List listByCondition(Map condition); + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/DataMatrixDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/DataMatrixDAO.java index 06dbb42f..fa367c51 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/DataMatrixDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/DataMatrixDAO.java @@ -1,9 +1,23 @@ -package com.alibaba.otter.manager.biz.config.datamatrix.dal; - -import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; -import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; - -public interface DataMatrixDAO extends GenericDAO { - - public DataMatrixDO findByGroupKey(String groupKey); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.datamatrix.dal; + +import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; +import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; + +public interface DataMatrixDAO extends GenericDAO { + + public DataMatrixDO findByGroupKey(String groupKey); +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/dataobject/DataMatrixDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/dataobject/DataMatrixDO.java index 470d89c1..2ee225d6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/dataobject/DataMatrixDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/dataobject/DataMatrixDO.java @@ -1,73 +1,87 @@ -package com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -public class DataMatrixDO implements Serializable { - - private static final long serialVersionUID = 9148286590254926037L; - private Long id; // 唯一标示id - private String groupKey; // groupKey - private String master; - private String slave; - private String description; // 描述 - private Date gmtCreate; // 创建时间 - private Date gmtModified; // 修改时间 - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getGroupKey() { - return groupKey; - } - - public void setGroupKey(String groupKey) { - this.groupKey = groupKey; - } - - public String getMaster() { - return master; - } - - public void setMaster(String master) { - this.master = master; - } - - public String getSlave() { - return slave; - } - - public void setSlave(String slave) { - this.slave = slave; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +public class DataMatrixDO implements Serializable { + + private static final long serialVersionUID = 9148286590254926037L; + private Long id; // 唯一标示id + private String groupKey; // groupKey + private String master; + private String slave; + private String description; // 描述 + private Date gmtCreate; // 创建时间 + private Date gmtModified; // 修改时间 + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getGroupKey() { + return groupKey; + } + + public void setGroupKey(String groupKey) { + this.groupKey = groupKey; + } + + public String getMaster() { + return master; + } + + public void setMaster(String master) { + this.master = master; + } + + public String getSlave() { + return slave; + } + + public void setSlave(String slave) { + this.slave = slave; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/ibatis/IbatisDataMatrixDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/ibatis/IbatisDataMatrixDAO.java index 3375da22..0bc212bc 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/ibatis/IbatisDataMatrixDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/dal/ibatis/IbatisDataMatrixDAO.java @@ -1,66 +1,80 @@ -package com.alibaba.otter.manager.biz.config.datamatrix.dal.ibatis; - -import java.util.List; -import java.util.Map; - -import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; - -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.manager.biz.config.datamatrix.dal.DataMatrixDAO; -import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; - -public class IbatisDataMatrixDAO extends SqlMapClientDaoSupport implements DataMatrixDAO { - - public DataMatrixDO insert(DataMatrixDO matrixDo) { - Assert.assertNotNull(matrixDo); - getSqlMapClientTemplate().insert("insertDataMatrix", matrixDo); - return matrixDo; - } - - public void delete(Long matrixId) { - Assert.assertNotNull(matrixId); - getSqlMapClientTemplate().delete("deleteDataMatrixById", matrixId); - } - - public void update(DataMatrixDO matrixDo) { - Assert.assertNotNull(matrixDo); - getSqlMapClientTemplate().update("updateDataMatrix", matrixDo); - } - - public List listAll() { - return (List) getSqlMapClientTemplate().queryForList("listDataMatrixs"); - } - - public List listByMultiId(Long... identities) { - List DataMatrixDOs = getSqlMapClientTemplate().queryForList("listDataMatrixByIds", identities); - return DataMatrixDOs; - } - - public boolean checkUnique(DataMatrixDO matrixDo) { - int count = (Integer) getSqlMapClientTemplate().queryForObject("checkDataMatrixUnique", matrixDo); - return count == 0 ? true : false; - } - - public DataMatrixDO findByGroupKey(String groupKey) { - Assert.assertNotNull(groupKey); - return (DataMatrixDO) getSqlMapClientTemplate().queryForObject("findDataMatrixByGroupKey", groupKey); - } - - public DataMatrixDO findById(Long identity) { - throw new UnsupportedOperationException(); - } - - public int getCount() { - return 0; - } - - public int getCount(Map condition) { - Integer count = (Integer) getSqlMapClientTemplate().queryForObject("getDataMatrixCount", condition); - return count.intValue(); - } - - public List listByCondition(Map condition) { - List DataMatrixDOs = getSqlMapClientTemplate().queryForList("listDataMatrixs", condition); - return DataMatrixDOs; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.datamatrix.dal.ibatis; + +import java.util.List; +import java.util.Map; + +import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; + +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.manager.biz.config.datamatrix.dal.DataMatrixDAO; +import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; + +public class IbatisDataMatrixDAO extends SqlMapClientDaoSupport implements DataMatrixDAO { + + public DataMatrixDO insert(DataMatrixDO matrixDo) { + Assert.assertNotNull(matrixDo); + getSqlMapClientTemplate().insert("insertDataMatrix", matrixDo); + return matrixDo; + } + + public void delete(Long matrixId) { + Assert.assertNotNull(matrixId); + getSqlMapClientTemplate().delete("deleteDataMatrixById", matrixId); + } + + public void update(DataMatrixDO matrixDo) { + Assert.assertNotNull(matrixDo); + getSqlMapClientTemplate().update("updateDataMatrix", matrixDo); + } + + public List listAll() { + return (List) getSqlMapClientTemplate().queryForList("listDataMatrixs"); + } + + public List listByMultiId(Long... identities) { + List DataMatrixDOs = getSqlMapClientTemplate().queryForList("listDataMatrixByIds", identities); + return DataMatrixDOs; + } + + public boolean checkUnique(DataMatrixDO matrixDo) { + int count = (Integer) getSqlMapClientTemplate().queryForObject("checkDataMatrixUnique", matrixDo); + return count == 0 ? true : false; + } + + public DataMatrixDO findByGroupKey(String groupKey) { + Assert.assertNotNull(groupKey); + return (DataMatrixDO) getSqlMapClientTemplate().queryForObject("findDataMatrixByGroupKey", groupKey); + } + + public DataMatrixDO findById(Long identity) { + throw new UnsupportedOperationException(); + } + + public int getCount() { + return 0; + } + + public int getCount(Map condition) { + Integer count = (Integer) getSqlMapClientTemplate().queryForObject("getDataMatrixCount", condition); + return count.intValue(); + } + + public List listByCondition(Map condition) { + List DataMatrixDOs = getSqlMapClientTemplate().queryForList("listDataMatrixs", condition); + return DataMatrixDOs; + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/impl/DataMatrixServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/impl/DataMatrixServiceImpl.java index d8e5efd0..5409bee0 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/impl/DataMatrixServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamatrix/impl/DataMatrixServiceImpl.java @@ -1,238 +1,252 @@ -package com.alibaba.otter.manager.biz.config.datamatrix.impl; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.TransactionCallbackWithoutResult; -import org.springframework.transaction.support.TransactionTemplate; - -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; -import com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException; -import com.alibaba.otter.manager.biz.config.datamatrix.DataMatrixService; -import com.alibaba.otter.manager.biz.config.datamatrix.dal.DataMatrixDAO; -import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; -import com.alibaba.otter.manager.biz.config.node.impl.NodeServiceImpl; -import com.alibaba.otter.shared.common.model.config.data.DataMatrix; -import com.alibaba.otter.shared.common.utils.JsonUtils; - -public class DataMatrixServiceImpl implements DataMatrixService { - - private static final Logger logger = LoggerFactory.getLogger(NodeServiceImpl.class); - - private DataMatrixDAO dataMatrixDao; - private TransactionTemplate transactionTemplate; - - /** - * 添加 - */ - public void create(final DataMatrix matrix) { - Assert.assertNotNull(matrix); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - DataMatrixDO matrixlDO = modelToDo(matrix); - matrixlDO.setId(0L); - if (!dataMatrixDao.checkUnique(matrixlDO)) { - String exceptionCause = "exist the same repeat canal in the database."; - logger.warn("WARN ## " + exceptionCause); - throw new RepeatConfigureException(exceptionCause); - } - dataMatrixDao.insert(matrixlDO); - } catch (RepeatConfigureException rce) { - throw rce; - } catch (Exception e) { - logger.error("ERROR ## create canal has an exception!"); - throw new ManagerException(e); - } - } - }); - } - - /** - * 删除 - */ - public void remove(final Long matrixId) { - Assert.assertNotNull(matrixId); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - dataMatrixDao.delete(matrixId); - } catch (Exception e) { - logger.error("ERROR ## remove canal(" + matrixId + ") has an exception!"); - throw new ManagerException(e); - } - } - }); - - } - - /** - * 修改 - */ - public void modify(final DataMatrix matrix) { - Assert.assertNotNull(matrix); - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - - protected void doInTransactionWithoutResult(TransactionStatus status) { - - try { - DataMatrixDO matrixDo = modelToDo(matrix); - if (dataMatrixDao.checkUnique(matrixDo)) { - dataMatrixDao.update(matrixDo); - } else { - String exceptionCause = "exist the same repeat matrix in the database."; - logger.warn("WARN ## " + exceptionCause); - throw new RepeatConfigureException(exceptionCause); - } - } catch (RepeatConfigureException rce) { - throw rce; - } catch (Exception e) { - logger.error("ERROR ## modify canal(" + matrix.getId() + ") has an exception!"); - throw new ManagerException(e); - } - } - }); - - } - - public List listByIds(Long... identities) { - List matrixs = new ArrayList(); - try { - List matrixDos = null; - if (identities.length < 1) { - matrixDos = dataMatrixDao.listAll(); - if (matrixDos.isEmpty()) { - logger.debug("DEBUG ## couldn't query any canal, maybe hasn't create any canal."); - return matrixs; - } - } else { - matrixDos = dataMatrixDao.listByMultiId(identities); - if (matrixDos.isEmpty()) { - String exceptionCause = "couldn't query any canal by matrixIds:" + Arrays.toString(identities); - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - } - matrixs = doToModel(matrixDos); - } catch (Exception e) { - logger.error("ERROR ## query channels has an exception!"); - throw new ManagerException(e); - } - - return matrixs; - } - - public List listAll() { - return listByIds(); - } - - public DataMatrix findById(Long matrixId) { - Assert.assertNotNull(matrixId); - List canals = listByIds(matrixId); - if (canals.size() != 1) { - String exceptionCause = "query matrixId:" + matrixId + " return null."; - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - - return canals.get(0); - } - - public DataMatrix findByGroupKey(String groupKey) { - Assert.assertNotNull(groupKey); - DataMatrixDO matrixDo = dataMatrixDao.findByGroupKey(groupKey); - if (matrixDo == null) { - String exceptionCause = "query name:" + groupKey + " return null."; - logger.error("ERROR ## " + exceptionCause); - throw new ManagerException(exceptionCause); - } - - return doToModel(matrixDo); - } - - @Override - public int getCount(Map condition) { - return dataMatrixDao.getCount(condition); - } - - @Override - public List listByCondition(Map condition) { - List matrixDos = dataMatrixDao.listByCondition(condition); - if (matrixDos.isEmpty()) { - logger.debug("DEBUG ## couldn't query any canal by the condition:" + JsonUtils.marshalToString(condition)); - return new ArrayList(); - } - - return doToModel(matrixDos); - } - - /** - * 用于Model对象转化为DO对象 - */ - private DataMatrixDO modelToDo(DataMatrix matrix) { - DataMatrixDO matrixDo = new DataMatrixDO(); - try { - matrixDo.setId(matrix.getId()); - matrixDo.setGroupKey(matrix.getGroupKey()); - matrixDo.setDescription(matrix.getDescription()); - matrixDo.setMaster(matrix.getMaster()); - matrixDo.setSlave(matrix.getSlave()); - matrixDo.setGmtCreate(matrix.getGmtCreate()); - matrixDo.setGmtModified(matrix.getGmtModified()); - } catch (Exception e) { - logger.error("ERROR ## change the matrix Model to Do has an exception"); - throw new ManagerException(e); - } - return matrixDo; - } - - /** - * 用于DO对象转化为Model对象 - */ - private DataMatrix doToModel(DataMatrixDO matrixDo) { - DataMatrix matrix = new DataMatrix(); - try { - matrix.setId(matrixDo.getId()); - matrix.setGroupKey(matrixDo.getGroupKey()); - matrix.setDescription(matrixDo.getDescription()); - matrix.setMaster(matrixDo.getMaster()); - matrix.setSlave(matrixDo.getSlave()); - matrix.setGmtCreate(matrixDo.getGmtCreate()); - matrix.setGmtModified(matrixDo.getGmtModified()); - } catch (Exception e) { - logger.error("ERROR ## change the canal Do to Model has an exception"); - throw new ManagerException(e); - } - - return matrix; - } - - private List doToModel(List matrixDos) { - List matrixs = new ArrayList(); - for (DataMatrixDO matrixDo : matrixDos) { - matrixs.add(doToModel(matrixDo)); - } - return matrixs; - } - - /* ------------------------setter / getter--------------------------- */ - - public void setTransactionTemplate(TransactionTemplate transactionTemplate) { - this.transactionTemplate = transactionTemplate; - } - - public void setDataMatrixDao(DataMatrixDAO dataMatrixDao) { - this.dataMatrixDao = dataMatrixDao; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.datamatrix.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; + +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; +import com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException; +import com.alibaba.otter.manager.biz.config.datamatrix.DataMatrixService; +import com.alibaba.otter.manager.biz.config.datamatrix.dal.DataMatrixDAO; +import com.alibaba.otter.manager.biz.config.datamatrix.dal.dataobject.DataMatrixDO; +import com.alibaba.otter.manager.biz.config.node.impl.NodeServiceImpl; +import com.alibaba.otter.shared.common.model.config.data.DataMatrix; +import com.alibaba.otter.shared.common.utils.JsonUtils; + +public class DataMatrixServiceImpl implements DataMatrixService { + + private static final Logger logger = LoggerFactory.getLogger(NodeServiceImpl.class); + + private DataMatrixDAO dataMatrixDao; + private TransactionTemplate transactionTemplate; + + /** + * 添加 + */ + public void create(final DataMatrix matrix) { + Assert.assertNotNull(matrix); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + DataMatrixDO matrixlDO = modelToDo(matrix); + matrixlDO.setId(0L); + if (!dataMatrixDao.checkUnique(matrixlDO)) { + String exceptionCause = "exist the same repeat canal in the database."; + logger.warn("WARN ## " + exceptionCause); + throw new RepeatConfigureException(exceptionCause); + } + dataMatrixDao.insert(matrixlDO); + } catch (RepeatConfigureException rce) { + throw rce; + } catch (Exception e) { + logger.error("ERROR ## create canal has an exception!"); + throw new ManagerException(e); + } + } + }); + } + + /** + * 删除 + */ + public void remove(final Long matrixId) { + Assert.assertNotNull(matrixId); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + dataMatrixDao.delete(matrixId); + } catch (Exception e) { + logger.error("ERROR ## remove canal(" + matrixId + ") has an exception!"); + throw new ManagerException(e); + } + } + }); + + } + + /** + * 修改 + */ + public void modify(final DataMatrix matrix) { + Assert.assertNotNull(matrix); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + + protected void doInTransactionWithoutResult(TransactionStatus status) { + + try { + DataMatrixDO matrixDo = modelToDo(matrix); + if (dataMatrixDao.checkUnique(matrixDo)) { + dataMatrixDao.update(matrixDo); + } else { + String exceptionCause = "exist the same repeat matrix in the database."; + logger.warn("WARN ## " + exceptionCause); + throw new RepeatConfigureException(exceptionCause); + } + } catch (RepeatConfigureException rce) { + throw rce; + } catch (Exception e) { + logger.error("ERROR ## modify canal(" + matrix.getId() + ") has an exception!"); + throw new ManagerException(e); + } + } + }); + + } + + public List listByIds(Long... identities) { + List matrixs = new ArrayList(); + try { + List matrixDos = null; + if (identities.length < 1) { + matrixDos = dataMatrixDao.listAll(); + if (matrixDos.isEmpty()) { + logger.debug("DEBUG ## couldn't query any canal, maybe hasn't create any canal."); + return matrixs; + } + } else { + matrixDos = dataMatrixDao.listByMultiId(identities); + if (matrixDos.isEmpty()) { + String exceptionCause = "couldn't query any canal by matrixIds:" + Arrays.toString(identities); + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + } + matrixs = doToModel(matrixDos); + } catch (Exception e) { + logger.error("ERROR ## query channels has an exception!"); + throw new ManagerException(e); + } + + return matrixs; + } + + public List listAll() { + return listByIds(); + } + + public DataMatrix findById(Long matrixId) { + Assert.assertNotNull(matrixId); + List canals = listByIds(matrixId); + if (canals.size() != 1) { + String exceptionCause = "query matrixId:" + matrixId + " return null."; + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + + return canals.get(0); + } + + public DataMatrix findByGroupKey(String groupKey) { + Assert.assertNotNull(groupKey); + DataMatrixDO matrixDo = dataMatrixDao.findByGroupKey(groupKey); + if (matrixDo == null) { + String exceptionCause = "query name:" + groupKey + " return null."; + logger.error("ERROR ## " + exceptionCause); + throw new ManagerException(exceptionCause); + } + + return doToModel(matrixDo); + } + + @Override + public int getCount(Map condition) { + return dataMatrixDao.getCount(condition); + } + + @Override + public List listByCondition(Map condition) { + List matrixDos = dataMatrixDao.listByCondition(condition); + if (matrixDos.isEmpty()) { + logger.debug("DEBUG ## couldn't query any canal by the condition:" + JsonUtils.marshalToString(condition)); + return new ArrayList(); + } + + return doToModel(matrixDos); + } + + /** + * 用于Model对象转化为DO对象 + */ + private DataMatrixDO modelToDo(DataMatrix matrix) { + DataMatrixDO matrixDo = new DataMatrixDO(); + try { + matrixDo.setId(matrix.getId()); + matrixDo.setGroupKey(matrix.getGroupKey()); + matrixDo.setDescription(matrix.getDescription()); + matrixDo.setMaster(matrix.getMaster()); + matrixDo.setSlave(matrix.getSlave()); + matrixDo.setGmtCreate(matrix.getGmtCreate()); + matrixDo.setGmtModified(matrix.getGmtModified()); + } catch (Exception e) { + logger.error("ERROR ## change the matrix Model to Do has an exception"); + throw new ManagerException(e); + } + return matrixDo; + } + + /** + * 用于DO对象转化为Model对象 + */ + private DataMatrix doToModel(DataMatrixDO matrixDo) { + DataMatrix matrix = new DataMatrix(); + try { + matrix.setId(matrixDo.getId()); + matrix.setGroupKey(matrixDo.getGroupKey()); + matrix.setDescription(matrixDo.getDescription()); + matrix.setMaster(matrixDo.getMaster()); + matrix.setSlave(matrixDo.getSlave()); + matrix.setGmtCreate(matrixDo.getGmtCreate()); + matrix.setGmtModified(matrixDo.getGmtModified()); + } catch (Exception e) { + logger.error("ERROR ## change the canal Do to Model has an exception"); + throw new ManagerException(e); + } + + return matrix; + } + + private List doToModel(List matrixDos) { + List matrixs = new ArrayList(); + for (DataMatrixDO matrixDo : matrixDos) { + matrixs.add(doToModel(matrixDo)); + } + return matrixs; + } + + /* ------------------------setter / getter--------------------------- */ + + public void setTransactionTemplate(TransactionTemplate transactionTemplate) { + this.transactionTemplate = transactionTemplate; + } + + public void setDataMatrixDao(DataMatrixDAO dataMatrixDao) { + this.dataMatrixDao = dataMatrixDao; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/DataMediaService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/DataMediaService.java index adfeb06b..b484c62a 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/DataMediaService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/DataMediaService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamedia; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/DataMediaDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/DataMediaDAO.java index 415cc26a..9ac0b79f 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/DataMediaDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/DataMediaDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamedia.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/dataobject/DataMediaDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/dataobject/DataMediaDO.java index 36e303ca..63d9e712 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/dataobject/DataMediaDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/dataobject/DataMediaDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamedia.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/ibatis/IbatisDataMediaDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/ibatis/IbatisDataMediaDAO.java index a4f23eb9..527bd3c4 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/ibatis/IbatisDataMediaDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/dal/ibatis/IbatisDataMediaDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamedia.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/impl/DataMediaServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/impl/DataMediaServiceImpl.java index c649b78e..bb5a1765 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/impl/DataMediaServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamedia/impl/DataMediaServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamedia.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/DataMediaPairService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/DataMediaPairService.java index 90a6707c..d39bd80e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/DataMediaPairService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/DataMediaPairService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediapair; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/DataMediaPairDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/DataMediaPairDAO.java index 79ff4287..64b957bd 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/DataMediaPairDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/DataMediaPairDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediapair.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/dataobject/DataMediaPairDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/dataobject/DataMediaPairDO.java index 7fdba4c9..40e084e5 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/dataobject/DataMediaPairDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/dataobject/DataMediaPairDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediapair.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/ibatis/IbatisDataMediaPairDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/ibatis/IbatisDataMediaPairDAO.java index 673c3ef6..24e2bab8 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/ibatis/IbatisDataMediaPairDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/dal/ibatis/IbatisDataMediaPairDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediapair.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/impl/DataMediaPairServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/impl/DataMediaPairServiceImpl.java index 66fc89bc..da654349 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/impl/DataMediaPairServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediapair/impl/DataMediaPairServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediapair.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/DataMediaSourceService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/DataMediaSourceService.java index 9254c394..409346a0 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/DataMediaSourceService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/DataMediaSourceService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediasource; import com.alibaba.otter.shared.common.model.config.data.DataMediaSource; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/DataMediaSourceDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/DataMediaSourceDAO.java index 45f5b897..94438892 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/DataMediaSourceDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/DataMediaSourceDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediasource.dal; import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/dataobject/DataMediaSourceDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/dataobject/DataMediaSourceDO.java index 42063c58..648816fe 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/dataobject/DataMediaSourceDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/dataobject/DataMediaSourceDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediasource.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/ibatis/IbatisDataMediaSourceDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/ibatis/IbatisDataMediaSourceDAO.java index 4b683bfb..95ecd841 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/ibatis/IbatisDataMediaSourceDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/dal/ibatis/IbatisDataMediaSourceDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediasource.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/impl/DataMediaSourceServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/impl/DataMediaSourceServiceImpl.java index ee8d9ba2..07240515 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/impl/DataMediaSourceServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/datamediasource/impl/DataMediaSourceServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.datamediasource.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/NodeService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/NodeService.java index 8546037b..8c093125 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/NodeService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/NodeService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node; import com.alibaba.otter.shared.common.model.config.node.Node; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/NodeDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/NodeDAO.java index 432e6b31..a6de48b7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/NodeDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/NodeDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node.dal; import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/dataobject/NodeDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/dataobject/NodeDO.java index 654c7ca5..0f2e7614 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/dataobject/NodeDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/dataobject/NodeDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/IbatisNodeDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/IbatisNodeDAO.java index f888b97b..60bd1c9e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/IbatisNodeDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/IbatisNodeDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/NodeParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/NodeParameterTypeHandler.java index 237a869c..71f2680f 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/NodeParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/dal/ibatis/NodeParameterTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/impl/NodeServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/impl/NodeServiceImpl.java index 8cce573a..5fd963a5 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/impl/NodeServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/node/impl/NodeServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.node.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/SystemParameterService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/SystemParameterService.java index 20a402a0..7b7c625c 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/SystemParameterService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/SystemParameterService.java @@ -1,13 +1,27 @@ -package com.alibaba.otter.manager.biz.config.parameter; - -import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; - -/** - * @author sarah.lij 2012-4-13 下午04:28:00 - */ -public interface SystemParameterService { - - public void createOrUpdate(SystemParameter systemParameter); - - public SystemParameter find(); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.parameter; + +import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; + +/** + * @author sarah.lij 2012-4-13 下午04:28:00 + */ +public interface SystemParameterService { + + public void createOrUpdate(SystemParameter systemParameter); + + public SystemParameter find(); +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/SystemParameterDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/SystemParameterDAO.java index 00a2988c..37beece1 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/SystemParameterDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/SystemParameterDAO.java @@ -1,11 +1,25 @@ -package com.alibaba.otter.manager.biz.config.parameter.dal; - -import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; -import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; - -/** - * @author sarah.lij 2012-4-13 下午04:44:24 - */ -public interface SystemParameterDAO extends GenericDAO { - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.parameter.dal; + +import com.alibaba.otter.manager.biz.common.basedao.GenericDAO; +import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; + +/** + * @author sarah.lij 2012-4-13 下午04:44:24 + */ +public interface SystemParameterDAO extends GenericDAO { + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/dataobject/SystemParameterDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/dataobject/SystemParameterDO.java index 101dc713..06314fa3 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/dataobject/SystemParameterDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/dataobject/SystemParameterDO.java @@ -1,51 +1,65 @@ -package com.alibaba.otter.manager.biz.config.parameter.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; - -/** - * @author sarah.lij 2012-4-13 下午04:46:04 - */ -public class SystemParameterDO implements Serializable { - - private static final long serialVersionUID = 9148286590254926037L; - private Long id; // 唯一标示id - private SystemParameter value; // 系统参数值 - private Date gmtCreate; // 创建时间 - private Date gmtModified; // 修改时间 - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public SystemParameter getValue() { - return value; - } - - public void setValue(SystemParameter value) { - this.value = value; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.parameter.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; + +/** + * @author sarah.lij 2012-4-13 下午04:46:04 + */ +public class SystemParameterDO implements Serializable { + + private static final long serialVersionUID = 9148286590254926037L; + private Long id; // 唯一标示id + private SystemParameter value; // 系统参数值 + private Date gmtCreate; // 创建时间 + private Date gmtModified; // 修改时间 + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public SystemParameter getValue() { + return value; + } + + public void setValue(SystemParameter value) { + this.value = value; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/IbatisSystemParameterDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/IbatisSystemParameterDAO.java index 0f0819b8..625fd905 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/IbatisSystemParameterDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/IbatisSystemParameterDAO.java @@ -1,61 +1,75 @@ -package com.alibaba.otter.manager.biz.config.parameter.dal.ibatis; - -import java.util.List; -import java.util.Map; - -import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; - -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.manager.biz.config.parameter.dal.SystemParameterDAO; -import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; - -/** - * SystemParameter的DAO层,ibatis的实现,主要是CRUD操作。 - * - * @author sarah.lij 2012-4-13 下午04:57:52 - */ -public class IbatisSystemParameterDAO extends SqlMapClientDaoSupport implements SystemParameterDAO { - - public SystemParameterDO insert(SystemParameterDO systemParameter) { - Assert.assertNotNull(systemParameter); - getSqlMapClientTemplate().insert("insertParameter", systemParameter); - return systemParameter; - } - - public void update(SystemParameterDO systemParameter) { - throw new UnsupportedOperationException(); - } - - public void delete(Long parameterId) { - throw new UnsupportedOperationException(); - } - - public boolean checkUnique(SystemParameterDO systemParameter) { - throw new UnsupportedOperationException(); - } - - public SystemParameterDO findById(Long parameterId) { - throw new UnsupportedOperationException(); - } - - public int getCount() { - throw new UnsupportedOperationException(); - } - - public int getCount(Map condition) { - throw new UnsupportedOperationException(); - } - - public List listAll() { - return (List) getSqlMapClientTemplate().queryForList("listParameters"); - } - - public List listByCondition(Map condition) { - throw new UnsupportedOperationException(); - } - - public List listByMultiId(Long... identities) { - throw new UnsupportedOperationException(); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.parameter.dal.ibatis; + +import java.util.List; +import java.util.Map; + +import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; + +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.manager.biz.config.parameter.dal.SystemParameterDAO; +import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; + +/** + * SystemParameter的DAO层,ibatis的实现,主要是CRUD操作。 + * + * @author sarah.lij 2012-4-13 下午04:57:52 + */ +public class IbatisSystemParameterDAO extends SqlMapClientDaoSupport implements SystemParameterDAO { + + public SystemParameterDO insert(SystemParameterDO systemParameter) { + Assert.assertNotNull(systemParameter); + getSqlMapClientTemplate().insert("insertParameter", systemParameter); + return systemParameter; + } + + public void update(SystemParameterDO systemParameter) { + throw new UnsupportedOperationException(); + } + + public void delete(Long parameterId) { + throw new UnsupportedOperationException(); + } + + public boolean checkUnique(SystemParameterDO systemParameter) { + throw new UnsupportedOperationException(); + } + + public SystemParameterDO findById(Long parameterId) { + throw new UnsupportedOperationException(); + } + + public int getCount() { + throw new UnsupportedOperationException(); + } + + public int getCount(Map condition) { + throw new UnsupportedOperationException(); + } + + public List listAll() { + return (List) getSqlMapClientTemplate().queryForList("listParameters"); + } + + public List listByCondition(Map condition) { + throw new UnsupportedOperationException(); + } + + public List listByMultiId(Long... identities) { + throw new UnsupportedOperationException(); + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/SystemParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/SystemParameterTypeHandler.java index f3e1aed0..150058e1 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/SystemParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/dal/ibatis/SystemParameterTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.parameter.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/impl/SystemParameterServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/impl/SystemParameterServiceImpl.java index 082fbc12..c58deb4c 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/impl/SystemParameterServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/parameter/impl/SystemParameterServiceImpl.java @@ -1,77 +1,91 @@ -package com.alibaba.otter.manager.biz.config.parameter.impl; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.shared.common.utils.Assert; -import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; -import com.alibaba.otter.manager.biz.config.parameter.SystemParameterService; -import com.alibaba.otter.manager.biz.config.parameter.dal.SystemParameterDAO; -import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; -import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; - -/** - * @author sarah.lij 2012-4-13 下午04:32:48 - */ -public class SystemParameterServiceImpl implements SystemParameterService { - - private static final Logger logger = LoggerFactory.getLogger(SystemParameterServiceImpl.class); - - private SystemParameterDAO systemParameterDao; - - /** - * 添加 - */ - public void createOrUpdate(SystemParameter systemParameter) { - Assert.assertNotNull(systemParameter); - try { - SystemParameterDO systemParameterDo = modelToDo(systemParameter); - systemParameterDo.setId(1L); - systemParameterDao.insert(systemParameterDo); // 底层使用merge sql,不需要判断update - } catch (Exception e) { - logger.error("ERROR ## create SystemParameter has an exception!"); - throw new ManagerException(e); - } - } - - public SystemParameter find() { - List systemParameterDos = systemParameterDao.listAll(); - if (systemParameterDos.isEmpty()) { - logger.debug("DEBUG ## couldn't query any SystemParameter, maybe hasn't create any SystemParameter."); - return new SystemParameter(); - } else { - return doToModel(systemParameterDos.get(0)); - } - } - - /** - * 类型:数据库类型 Mysql和Oracle 用于Model对象转化为DO对象 - * - * @param SystemParameter - * @return SystemParameterDO - */ - private SystemParameterDO modelToDo(SystemParameter systemParameter) { - SystemParameterDO systemParameterDo = new SystemParameterDO(); - systemParameterDo.setValue(systemParameter); - return systemParameterDo; - } - - /** - * 类型:数据库类型 Mysql和Oracle 用于DO对象转化为Model对象 - * - * @param SystemParameterDo - * @return SystemParameter - */ - private SystemParameter doToModel(SystemParameterDO systemParameterDo) { - return systemParameterDo.getValue(); - } - - /* ------------------------setter / getter--------------------------- */ - - public void setsystemParameterDao(SystemParameterDAO systemParameterDao) { - this.systemParameterDao = systemParameterDao; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.config.parameter.impl; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.shared.common.utils.Assert; +import com.alibaba.otter.manager.biz.common.exceptions.ManagerException; +import com.alibaba.otter.manager.biz.config.parameter.SystemParameterService; +import com.alibaba.otter.manager.biz.config.parameter.dal.SystemParameterDAO; +import com.alibaba.otter.manager.biz.config.parameter.dal.dataobject.SystemParameterDO; +import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter; + +/** + * @author sarah.lij 2012-4-13 下午04:32:48 + */ +public class SystemParameterServiceImpl implements SystemParameterService { + + private static final Logger logger = LoggerFactory.getLogger(SystemParameterServiceImpl.class); + + private SystemParameterDAO systemParameterDao; + + /** + * 添加 + */ + public void createOrUpdate(SystemParameter systemParameter) { + Assert.assertNotNull(systemParameter); + try { + SystemParameterDO systemParameterDo = modelToDo(systemParameter); + systemParameterDo.setId(1L); + systemParameterDao.insert(systemParameterDo); // 底层使用merge sql,不需要判断update + } catch (Exception e) { + logger.error("ERROR ## create SystemParameter has an exception!"); + throw new ManagerException(e); + } + } + + public SystemParameter find() { + List systemParameterDos = systemParameterDao.listAll(); + if (systemParameterDos.isEmpty()) { + logger.debug("DEBUG ## couldn't query any SystemParameter, maybe hasn't create any SystemParameter."); + return new SystemParameter(); + } else { + return doToModel(systemParameterDos.get(0)); + } + } + + /** + * 类型:数据库类型 Mysql和Oracle 用于Model对象转化为DO对象 + * + * @param SystemParameter + * @return SystemParameterDO + */ + private SystemParameterDO modelToDo(SystemParameter systemParameter) { + SystemParameterDO systemParameterDo = new SystemParameterDO(); + systemParameterDo.setValue(systemParameter); + return systemParameterDo; + } + + /** + * 类型:数据库类型 Mysql和Oracle 用于DO对象转化为Model对象 + * + * @param SystemParameterDo + * @return SystemParameter + */ + private SystemParameter doToModel(SystemParameterDO systemParameterDo) { + return systemParameterDo.getValue(); + } + + /* ------------------------setter / getter--------------------------- */ + + public void setsystemParameterDao(SystemParameterDAO systemParameterDao) { + this.systemParameterDao = systemParameterDao; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/PipelineService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/PipelineService.java index 64188253..f1681d36 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/PipelineService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/PipelineService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineDAO.java index 2a2aa46f..b9821df7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineNodeRelationDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineNodeRelationDAO.java index 6b92bbc0..a1936f23 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineNodeRelationDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/PipelineNodeRelationDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineDO.java index 60936e77..3f30c809 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineNodeRelationDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineNodeRelationDO.java index d5e79457..bbb548ce 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineNodeRelationDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/dataobject/PipelineNodeRelationDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineDAO.java index 8d223637..05896541 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineNodeRelationDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineNodeRelationDAO.java index 5f92eb98..7fc407e5 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineNodeRelationDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/IbatisPipelineNodeRelationDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/PipelineParameterTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/PipelineParameterTypeHandler.java index 20692f30..1745cd07 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/PipelineParameterTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/dal/ibatis/PipelineParameterTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.dal.ibatis; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/impl/PipelineServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/impl/PipelineServiceImpl.java index 28331185..b70c9267 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/impl/PipelineServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/pipeline/impl/PipelineServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.pipeline.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/LogRecordService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/LogRecordService.java index 4bfaea46..6f3b8b91 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/LogRecordService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/LogRecordService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.record; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/LogRecordDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/LogRecordDAO.java index 781a5ff1..94bec25f 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/LogRecordDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/LogRecordDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.record.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/dataobject/LogRecordDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/dataobject/LogRecordDO.java index 55e9ea30..bf97734e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/dataobject/LogRecordDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/dataobject/LogRecordDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.record.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/ibatis/IbatisLogRecordDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/ibatis/IbatisLogRecordDAO.java index 34684073..12c74f8f 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/ibatis/IbatisLogRecordDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/dal/ibatis/IbatisLogRecordDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.record.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/impl/LogRecordServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/impl/LogRecordServiceImpl.java index 449b9eee..043779c6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/impl/LogRecordServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/record/impl/LogRecordServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.record.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/ListTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/ListTypeHandler.java index a399def8..c202f030 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/ListTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/ListTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.utils; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/MapTypeHandler.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/MapTypeHandler.java index 926cbd3b..67383c4b 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/MapTypeHandler.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/config/utils/MapTypeHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.config.utils; import java.sql.SQLException; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmController.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmController.java index dcc598bd..8b228db2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmController.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.Map; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmRecovery.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmRecovery.java index 6a30b00e..72cc2e26 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmRecovery.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/AlarmRecovery.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import com.alibaba.otter.shared.common.model.config.alarm.AlarmRule; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/Monitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/Monitor.java index 3a61ab75..8b14a7b4 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/Monitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/Monitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorRuleExplorerRegisty.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorRuleExplorerRegisty.java index 6d91be55..65299ae5 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorRuleExplorerRegisty.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorRuleExplorerRegisty.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.Collection; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorTimer.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorTimer.java index daec7cd6..8332155d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorTimer.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/MonitorTimer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/PassiveMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/PassiveMonitor.java index 279b26c6..f66e105a 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/PassiveMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/PassiveMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AbstractRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AbstractRuleMonitor.java index 48904c53..91a71f4b 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AbstractRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AbstractRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Calendar; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AlarmRecoveryDelayed.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AlarmRecoveryDelayed.java index a5746ed1..1d958824 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AlarmRecoveryDelayed.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/AlarmRecoveryDelayed.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.concurrent.Delayed; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DefaultAlarmController.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DefaultAlarmController.java index 094e3dc7..8700e355 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DefaultAlarmController.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DefaultAlarmController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Collections; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DelayStatRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DelayStatRuleMonitor.java index 2ca94672..cf6cebb5 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DelayStatRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/DelayStatRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ExceptionRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ExceptionRuleMonitor.java index e293bfb5..02d916c6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ExceptionRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ExceptionRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/GlobalMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/GlobalMonitor.java index 5208e2b5..310d6772 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/GlobalMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/GlobalMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PausedRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PausedRuleMonitor.java index 9d495c27..39285f38 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PausedRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PausedRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineMonitor.java index 3ec18f5f..6a23e09d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineTimeoutRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineTimeoutRuleMonitor.java index 7b5e9b2f..5f238f31 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineTimeoutRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PipelineTimeoutRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PositionTimeoutRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PositionTimeoutRuleMonitor.java index 6f77432f..96b1b3ee 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PositionTimeoutRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/PositionTimeoutRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ProcessTimeoutRuleMonitor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ProcessTimeoutRuleMonitor.java index e2429a56..07aa7658 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ProcessTimeoutRuleMonitor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/ProcessTimeoutRuleMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.Collections; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/RestartAlarmRecovery.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/RestartAlarmRecovery.java index c7c0a7d4..74dd33ab 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/RestartAlarmRecovery.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/monitor/impl/RestartAlarmRecovery.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor.impl; import java.util.concurrent.DelayQueue; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ArbitrateRemoteService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ArbitrateRemoteService.java index caee6b50..bde93172 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ArbitrateRemoteService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ArbitrateRemoteService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote; import com.alibaba.otter.shared.communication.model.arbitrate.NodeAlarmEvent; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/CanalRemoteService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/CanalRemoteService.java index 647a85a9..ea96cd61 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/CanalRemoteService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/CanalRemoteService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote; import com.alibaba.otter.canal.instance.manager.model.Canal; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ConfigRemoteService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ConfigRemoteService.java index 2db76cd6..dbb54e0a 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ConfigRemoteService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/ConfigRemoteService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/NodeRemoteService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/NodeRemoteService.java index a507ac9e..233dc9a3 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/NodeRemoteService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/NodeRemoteService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/StatsRemoteService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/StatsRemoteService.java index 2884e515..74c8b261 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/StatsRemoteService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/StatsRemoteService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote; import com.alibaba.otter.shared.communication.model.statistics.DelayCountEvent; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ArbitrateRemoteServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ArbitrateRemoteServiceImpl.java index d17cb027..a3732bc4 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ArbitrateRemoteServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ArbitrateRemoteServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.impl; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/CanalRemoteServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/CanalRemoteServiceImpl.java index fd1d7b50..5cf911d7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/CanalRemoteServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/CanalRemoteServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.impl; import com.alibaba.otter.canal.instance.manager.model.Canal; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ConfigRemoteServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ConfigRemoteServiceImpl.java index 0a25d8f8..3acdef29 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ConfigRemoteServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/ConfigRemoteServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/NodeMBeanServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/NodeMBeanServiceImpl.java index 862c47c0..ffb37c27 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/NodeMBeanServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/NodeMBeanServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.impl; import java.text.MessageFormat; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/StatsRemoteServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/StatsRemoteServiceImpl.java index fe0e5ab6..4d0651c3 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/StatsRemoteServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/impl/StatsRemoteServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.impl; import java.util.Collection; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/interceptor/RemoteExceptionLoggerInterceptor.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/interceptor/RemoteExceptionLoggerInterceptor.java index d09b241c..7616cdda 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/interceptor/RemoteExceptionLoggerInterceptor.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/remote/interceptor/RemoteExceptionLoggerInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.remote.interceptor; import java.io.PrintWriter; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayCounter.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayCounter.java index aba61f84..46dcba10 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayCounter.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayCounter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay; /** diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayStatService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayStatService.java index 9c06df3b..c140f216 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayStatService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/DelayStatService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/DelayStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/DelayStatDAO.java index a3ad3b4d..f5f2dca2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/DelayStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/DelayStatDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay.dal; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/dataobject/DelayStatDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/dataobject/DelayStatDO.java index 70739385..486126ce 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/dataobject/DelayStatDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/dataobject/DelayStatDO.java @@ -1,76 +1,90 @@ -package com.alibaba.otter.manager.biz.statistics.delay.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author danping.yudp - */ - -public class DelayStatDO implements Serializable { - - private static final long serialVersionUID = 1L; - private Long id; - private Long delayTime; - private Long delayNumber; - private Long pipelineId; - private Date gmtCreate; - private Date gmtModified; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getDelayTime() { - return delayTime; - } - - public void setDelayTime(Long delayTime) { - this.delayTime = delayTime; - } - - public Long getDelayNumber() { - return delayNumber; - } - - public void setDelayNumber(Long delayNumber) { - this.delayNumber = delayNumber; - } - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.delay.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author danping.yudp + */ + +public class DelayStatDO implements Serializable { + + private static final long serialVersionUID = 1L; + private Long id; + private Long delayTime; + private Long delayNumber; + private Long pipelineId; + private Date gmtCreate; + private Date gmtModified; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getDelayTime() { + return delayTime; + } + + public void setDelayTime(Long delayTime) { + this.delayTime = delayTime; + } + + public Long getDelayNumber() { + return delayNumber; + } + + public void setDelayNumber(Long delayNumber) { + this.delayNumber = delayNumber; + } + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/ibatis/IbatisDelayStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/ibatis/IbatisDelayStatDAO.java index f815203f..77644402 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/ibatis/IbatisDelayStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/dal/ibatis/IbatisDelayStatDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay.dal.ibatis; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/impl/DelayStatServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/impl/DelayStatServiceImpl.java index ff46d68b..25f7eb3f 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/impl/DelayStatServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/impl/DelayStatServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayCountParam.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayCountParam.java index afbdadd7..87b087b2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayCountParam.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayCountParam.java @@ -1,27 +1,41 @@ -package com.alibaba.otter.manager.biz.statistics.delay.param; - -/** - * @author danping.yudp - */ -public class DelayCountParam { - - private Long pipelineId; - private Long number; - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Long getNumber() { - return number; - } - - public void setNumber(Long number) { - this.number = number; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.delay.param; + +/** + * @author danping.yudp + */ +public class DelayCountParam { + + private Long pipelineId; + private Long number; + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayStatInfo.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayStatInfo.java index d8b621a1..2bdb5070 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayStatInfo.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/DelayStatInfo.java @@ -1,53 +1,67 @@ -package com.alibaba.otter.manager.biz.statistics.delay.param; - -import java.io.Serializable; -import java.util.List; - -import com.alibaba.otter.shared.common.model.statistics.delay.DelayStat; - -public class DelayStatInfo implements Serializable { - - private static final long serialVersionUID = -6145961871313642767L; - private List items; - - /** - * 一段时间内堆积量的平均值统计 - */ - - public Double getAvgDelayNumber() { - Double avgDelayNumber = 0.0; - if (items.size() != 0) { - for (DelayStat item : items) { - avgDelayNumber += item.getDelayNumber(); - } - avgDelayNumber = avgDelayNumber / items.size(); - } - return avgDelayNumber; - } - - /** - * 一段时间内延迟时间的平均值统计 - */ - - public Double getAvgDelayTime() { - Double avgDelayTime = 0.0; - if (items.size() != 0) { - for (DelayStat item : items) { - avgDelayTime += item.getDelayTime(); - } - avgDelayTime = avgDelayTime / items.size(); - } - return avgDelayTime; - } - - // ===================== setter / getter ========================= - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.delay.param; + +import java.io.Serializable; +import java.util.List; + +import com.alibaba.otter.shared.common.model.statistics.delay.DelayStat; + +public class DelayStatInfo implements Serializable { + + private static final long serialVersionUID = -6145961871313642767L; + private List items; + + /** + * 一段时间内堆积量的平均值统计 + */ + + public Double getAvgDelayNumber() { + Double avgDelayNumber = 0.0; + if (items.size() != 0) { + for (DelayStat item : items) { + avgDelayNumber += item.getDelayNumber(); + } + avgDelayNumber = avgDelayNumber / items.size(); + } + return avgDelayNumber; + } + + /** + * 一段时间内延迟时间的平均值统计 + */ + + public Double getAvgDelayTime() { + Double avgDelayTime = 0.0; + if (items.size() != 0) { + for (DelayStat item : items) { + avgDelayTime += item.getDelayTime(); + } + avgDelayTime = avgDelayTime / items.size(); + } + return avgDelayTime; + } + + // ===================== setter / getter ========================= + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TimelineDelayCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TimelineDelayCondition.java index 2d4e02a9..9a2c6037 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TimelineDelayCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TimelineDelayCondition.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay.param; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TopDelayStat.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TopDelayStat.java index 250b0321..4321122b 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TopDelayStat.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/delay/param/TopDelayStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.delay.param; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/ProcessStatService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/ProcessStatService.java index 5713617c..8e4805b4 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/ProcessStatService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/ProcessStatService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.stage; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ProcessDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ProcessDAO.java index f3ac78cc..66d33d95 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ProcessDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ProcessDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.stage.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/dataobject/ProcessStatDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/dataobject/ProcessStatDO.java index cf1bd66c..93690a5b 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/dataobject/ProcessStatDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/dataobject/ProcessStatDO.java @@ -1,52 +1,66 @@ -package com.alibaba.otter.manager.biz.statistics.stage.dal.dataobject; - -import java.io.Serializable; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.model.statistics.stage.StageStat; -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * TODO Comment of TableStat - * - * @author danping.yudp - */ - -public class ProcessStatDO implements Serializable { - - private static final long serialVersionUID = -5625269232233751756L; - private Long pipelineId; - private Long processId; - private List stageStats; // 当前process的阶段列表 - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Long getProcessId() { - return processId; - } - - public void setProcessId(Long processId) { - this.processId = processId; - } - - public List getStageStats() { - return stageStats; - } - - public void setStageStats(List stageStats) { - this.stageStats = stageStats; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.stage.dal.dataobject; + +import java.io.Serializable; +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.model.statistics.stage.StageStat; +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * TODO Comment of TableStat + * + * @author danping.yudp + */ + +public class ProcessStatDO implements Serializable { + + private static final long serialVersionUID = -5625269232233751756L; + private Long pipelineId; + private Long processId; + private List stageStats; // 当前process的阶段列表 + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Long getProcessId() { + return processId; + } + + public void setProcessId(Long processId) { + this.processId = processId; + } + + public List getStageStats() { + return stageStats; + } + + public void setStageStats(List stageStats) { + this.stageStats = stageStats; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ibatis/IbatisProcessDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ibatis/IbatisProcessDAO.java index 6fc1dad0..ce0ceab6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ibatis/IbatisProcessDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/dal/ibatis/IbatisProcessDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.stage.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/impl/ProcessStatServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/impl/ProcessStatServiceImpl.java index e7cdf5db..e66a2686 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/impl/ProcessStatServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/stage/impl/ProcessStatServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.stage.impl; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/TableStatService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/TableStatService.java index 62d7ec8a..ac540fa2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/TableStatService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/TableStatService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.table; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableHistoryStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableHistoryStatDAO.java index d67ce822..5991ee35 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableHistoryStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableHistoryStatDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.table.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableStatDAO.java index e7f498ee..fea5f193 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/TableStatDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.table.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableHistoryStatDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableHistoryStatDO.java index 0ea90f81..2e21706e 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableHistoryStatDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableHistoryStatDO.java @@ -1,130 +1,144 @@ -package com.alibaba.otter.manager.biz.statistics.table.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author danping.yudp - */ - -public class TableHistoryStatDO implements Serializable { - - private static final long serialVersionUID = 1L; - private Long id; - private Date startTime; - private Date endTime; - private Long fileSize; - private Long fileCount; - private Long insertCount; - private Long updateCount; - private Long deleteCount; - private Long dataMediaPairId; - private Long pipelineId; - private Date gmtCreate; - private Date gmtModified; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public Long getFileSize() { - return fileSize; - } - - public void setFileSize(Long fileSize) { - this.fileSize = fileSize; - } - - public Long getFileCount() { - return fileCount; - } - - public void setFileCount(Long fileCount) { - this.fileCount = fileCount; - } - - public Long getInsertCount() { - return insertCount; - } - - public void setInsertCount(Long insertCount) { - this.insertCount = insertCount; - } - - public Long getUpdateCount() { - return updateCount; - } - - public void setUpdateCount(Long updateCount) { - this.updateCount = updateCount; - } - - public Long getDeleteCount() { - return deleteCount; - } - - public void setDeleteCount(Long deleteCount) { - this.deleteCount = deleteCount; - } - - public Long getDataMediaPairId() { - return dataMediaPairId; - } - - public void setDataMediaPairId(Long dataMediaPairId) { - this.dataMediaPairId = dataMediaPairId; - } - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author danping.yudp + */ + +public class TableHistoryStatDO implements Serializable { + + private static final long serialVersionUID = 1L; + private Long id; + private Date startTime; + private Date endTime; + private Long fileSize; + private Long fileCount; + private Long insertCount; + private Long updateCount; + private Long deleteCount; + private Long dataMediaPairId; + private Long pipelineId; + private Date gmtCreate; + private Date gmtModified; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public Long getFileCount() { + return fileCount; + } + + public void setFileCount(Long fileCount) { + this.fileCount = fileCount; + } + + public Long getInsertCount() { + return insertCount; + } + + public void setInsertCount(Long insertCount) { + this.insertCount = insertCount; + } + + public Long getUpdateCount() { + return updateCount; + } + + public void setUpdateCount(Long updateCount) { + this.updateCount = updateCount; + } + + public Long getDeleteCount() { + return deleteCount; + } + + public void setDeleteCount(Long deleteCount) { + this.deleteCount = deleteCount; + } + + public Long getDataMediaPairId() { + return dataMediaPairId; + } + + public void setDataMediaPairId(Long dataMediaPairId) { + this.dataMediaPairId = dataMediaPairId; + } + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableStatDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableStatDO.java index 757443a8..6e6ce8ec 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableStatDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/dataobject/TableStatDO.java @@ -1,112 +1,126 @@ -package com.alibaba.otter.manager.biz.statistics.table.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author danping.yudp - */ - -public class TableStatDO implements Serializable { - - private static final long serialVersionUID = 1L; - private Long id; - private Long fileSize; - private Long fileCount; - private Long insertCount; - private Long updateCount; - private Long deleteCount; - private Long dataMediaPairId; - private Long pipelineId; - private Date gmtCreate; - private Date gmtModified; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getFileSize() { - return fileSize; - } - - public void setFileSize(Long fileSize) { - this.fileSize = fileSize; - } - - public Long getFileCount() { - return fileCount; - } - - public void setFileCount(Long fileCount) { - this.fileCount = fileCount; - } - - public Long getInsertCount() { - return insertCount; - } - - public void setInsertCount(Long insertCount) { - this.insertCount = insertCount; - } - - public Long getUpdateCount() { - return updateCount; - } - - public void setUpdateCount(Long updateCount) { - this.updateCount = updateCount; - } - - public Long getDeleteCount() { - return deleteCount; - } - - public void setDeleteCount(Long deleteCount) { - this.deleteCount = deleteCount; - } - - public Long getDataMediaPairId() { - return dataMediaPairId; - } - - public void setDataMediaPairId(Long dataMediaPairId) { - this.dataMediaPairId = dataMediaPairId; - } - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author danping.yudp + */ + +public class TableStatDO implements Serializable { + + private static final long serialVersionUID = 1L; + private Long id; + private Long fileSize; + private Long fileCount; + private Long insertCount; + private Long updateCount; + private Long deleteCount; + private Long dataMediaPairId; + private Long pipelineId; + private Date gmtCreate; + private Date gmtModified; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public Long getFileCount() { + return fileCount; + } + + public void setFileCount(Long fileCount) { + this.fileCount = fileCount; + } + + public Long getInsertCount() { + return insertCount; + } + + public void setInsertCount(Long insertCount) { + this.insertCount = insertCount; + } + + public Long getUpdateCount() { + return updateCount; + } + + public void setUpdateCount(Long updateCount) { + this.updateCount = updateCount; + } + + public Long getDeleteCount() { + return deleteCount; + } + + public void setDeleteCount(Long deleteCount) { + this.deleteCount = deleteCount; + } + + public Long getDataMediaPairId() { + return dataMediaPairId; + } + + public void setDataMediaPairId(Long dataMediaPairId) { + this.dataMediaPairId = dataMediaPairId; + } + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableHistoryStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableHistoryStatDAO.java index 5f17bc9b..073b3c7c 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableHistoryStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableHistoryStatDAO.java @@ -1,26 +1,40 @@ -package com.alibaba.otter.manager.biz.statistics.table.dal.ibatis; - -import java.util.List; - -import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; - -import com.alibaba.otter.manager.biz.statistics.table.dal.TableHistoryStatDAO; -import com.alibaba.otter.manager.biz.statistics.table.dal.dataobject.TableHistoryStatDO; -import com.alibaba.otter.manager.biz.statistics.table.param.BehaviorHistoryCondition; - -/** - * @author sarah.lij 2012-7-17 下午06:35:52 - */ -public class IbatisTableHistoryStatDAO extends SqlMapClientDaoSupport implements TableHistoryStatDAO { - - @Override - public void insertTableHistoryStat(TableHistoryStatDO tableHistoryStatDO) { - getSqlMapClientTemplate().insert("insertTableHistoryStat", tableHistoryStatDO); - } - - @Override - public List listTimelineTableStat(BehaviorHistoryCondition condition) { - return (List) getSqlMapClientTemplate().queryForList("listTimelineTableStat", condition); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.dal.ibatis; + +import java.util.List; + +import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; + +import com.alibaba.otter.manager.biz.statistics.table.dal.TableHistoryStatDAO; +import com.alibaba.otter.manager.biz.statistics.table.dal.dataobject.TableHistoryStatDO; +import com.alibaba.otter.manager.biz.statistics.table.param.BehaviorHistoryCondition; + +/** + * @author sarah.lij 2012-7-17 下午06:35:52 + */ +public class IbatisTableHistoryStatDAO extends SqlMapClientDaoSupport implements TableHistoryStatDAO { + + @Override + public void insertTableHistoryStat(TableHistoryStatDO tableHistoryStatDO) { + getSqlMapClientTemplate().insert("insertTableHistoryStat", tableHistoryStatDO); + } + + @Override + public List listTimelineTableStat(BehaviorHistoryCondition condition) { + return (List) getSqlMapClientTemplate().queryForList("listTimelineTableStat", condition); + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableStatDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableStatDAO.java index 1e4d8d9e..699f90dc 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableStatDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/dal/ibatis/IbatisTableStatDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.table.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/impl/TableStatServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/impl/TableStatServiceImpl.java index 85c002f1..e74318b6 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/impl/TableStatServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/impl/TableStatServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.table.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryCondition.java index b747f04b..088c7b6c 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryCondition.java @@ -1,36 +1,50 @@ -package com.alibaba.otter.manager.biz.statistics.table.param; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author jianghang 2011-9-8 下午01:21:09 - */ -public class BehaviorHistoryCondition { - - private Long pairId; - private boolean detail; - - public Long getPairId() { - return pairId; - } - - public void setPairId(Long pairId) { - this.pairId = pairId; - } - - public boolean isDetail() { - return detail; - } - - public void setDetail(boolean detail) { - this.detail = detail; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.param; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author jianghang 2011-9-8 下午01:21:09 + */ +public class BehaviorHistoryCondition { + + private Long pairId; + private boolean detail; + + public Long getPairId() { + return pairId; + } + + public void setPairId(Long pairId) { + this.pairId = pairId; + } + + public boolean isDetail() { + return detail; + } + + public void setDetail(boolean detail) { + this.detail = detail; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryInfo.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryInfo.java index 84be5806..e44cc2a2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryInfo.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/BehaviorHistoryInfo.java @@ -1,190 +1,204 @@ -package com.alibaba.otter.manager.biz.statistics.table.param; - -import java.util.List; - -import com.alibaba.otter.shared.common.model.statistics.table.TableStat; - -/** - * @author sarah.lij 2012-7-13 下午03:29:08 - */ -public class BehaviorHistoryInfo { - - private List items; - - /** - * 对应insertCount的数据统计平均值 - */ - - public Long getInsertCountAvg() { - Long insertCountAvg = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - if (item.getEndTime().equals(item.getStartTime())) { - insertCountAvg += item.getInsertCount(); - } else { - insertCountAvg += item.getInsertCount() * 1000 - / (item.getEndTime().getTime() - item.getStartTime().getTime()); - } - } - insertCountAvg = insertCountAvg / items.size(); - } - return insertCountAvg; - - } - - /** - * 对应updateCount的数据统计平均值 - */ - - public Long getUpdateCountAvg() { - Long updateCountAvg = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - if (item.getEndTime().equals(item.getStartTime())) { - updateCountAvg += item.getUpdateCount(); - } else { - updateCountAvg += item.getUpdateCount() * 1000 - / (item.getEndTime().getTime() - item.getStartTime().getTime()); - } - } - updateCountAvg = updateCountAvg / items.size(); - } - return updateCountAvg; - - } - - /** - * 对应deleteCount的数据统计平均值 - */ - - public Long getDeleteCountAvg() { - Long deleteCountAvg = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - if (item.getEndTime().equals(item.getStartTime())) { - deleteCountAvg += item.getDeleteCount(); - } else { - deleteCountAvg += item.getDeleteCount() * 1000 - / (item.getEndTime().getTime() - item.getStartTime().getTime()); - } - } - deleteCountAvg = deleteCountAvg / items.size(); - } - return deleteCountAvg; - } - - /** - * 对应deleteCount的数据统计平均值 - */ - - public Long getFileCountAvg() { - Long fileCountAvg = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - if (item.getEndTime().equals(item.getStartTime())) { - fileCountAvg += item.getFileCount(); - } else { - fileCountAvg += item.getFileCount() * 1000 - / (item.getEndTime().getTime() - item.getStartTime().getTime()); - } - } - fileCountAvg = fileCountAvg / items.size(); - } - return fileCountAvg; - } - - /** - * 对应deleteCount的数据统计平均值 - */ - - public Long getFileSizeAvg() { - Long fileSizeAvg = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - if (item.getEndTime().equals(item.getStartTime())) { - fileSizeAvg += item.getFileSize(); - } else { - fileSizeAvg += item.getFileSize() * 1000 - / (item.getEndTime().getTime() - item.getStartTime().getTime()); - } - } - fileSizeAvg = fileSizeAvg / items.size(); - } - return fileSizeAvg; - } - - /** - * 对应insertCount的数据统计 - */ - public Long getInsertNumber() { - Long insertNumber = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - insertNumber += item.getInsertCount(); - } - } - return insertNumber; - } - - /** - * 对应updateCount的数据统计 - */ - public Long getUpdateNumber() { - Long updateNumber = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - updateNumber += item.getUpdateCount(); - } - } - return updateNumber; - } - - /** - * 对应deleteCount的数据统计 - */ - public Long getDeleteNumber() { - Long deleteNumber = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - deleteNumber += item.getDeleteCount(); - } - } - return deleteNumber; - } - - /** - * 对应fileNumber的数据统计 - */ - public Long getFileNumber() { - Long fileNumber = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - fileNumber += item.getFileCount(); - } - } - return fileNumber; - } - - /** - * 对应fileSize的数据统计 - */ - public Long getFileSize() { - Long fileSize = 0L; - if (items.size() != 0) { - for (TableStat item : items) { - fileSize += item.getFileSize(); - } - } - return fileSize; - } - - // ===================== setter / getter ========================= - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.param; + +import java.util.List; + +import com.alibaba.otter.shared.common.model.statistics.table.TableStat; + +/** + * @author sarah.lij 2012-7-13 下午03:29:08 + */ +public class BehaviorHistoryInfo { + + private List items; + + /** + * 对应insertCount的数据统计平均值 + */ + + public Long getInsertCountAvg() { + Long insertCountAvg = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + if (item.getEndTime().equals(item.getStartTime())) { + insertCountAvg += item.getInsertCount(); + } else { + insertCountAvg += item.getInsertCount() * 1000 + / (item.getEndTime().getTime() - item.getStartTime().getTime()); + } + } + insertCountAvg = insertCountAvg / items.size(); + } + return insertCountAvg; + + } + + /** + * 对应updateCount的数据统计平均值 + */ + + public Long getUpdateCountAvg() { + Long updateCountAvg = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + if (item.getEndTime().equals(item.getStartTime())) { + updateCountAvg += item.getUpdateCount(); + } else { + updateCountAvg += item.getUpdateCount() * 1000 + / (item.getEndTime().getTime() - item.getStartTime().getTime()); + } + } + updateCountAvg = updateCountAvg / items.size(); + } + return updateCountAvg; + + } + + /** + * 对应deleteCount的数据统计平均值 + */ + + public Long getDeleteCountAvg() { + Long deleteCountAvg = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + if (item.getEndTime().equals(item.getStartTime())) { + deleteCountAvg += item.getDeleteCount(); + } else { + deleteCountAvg += item.getDeleteCount() * 1000 + / (item.getEndTime().getTime() - item.getStartTime().getTime()); + } + } + deleteCountAvg = deleteCountAvg / items.size(); + } + return deleteCountAvg; + } + + /** + * 对应deleteCount的数据统计平均值 + */ + + public Long getFileCountAvg() { + Long fileCountAvg = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + if (item.getEndTime().equals(item.getStartTime())) { + fileCountAvg += item.getFileCount(); + } else { + fileCountAvg += item.getFileCount() * 1000 + / (item.getEndTime().getTime() - item.getStartTime().getTime()); + } + } + fileCountAvg = fileCountAvg / items.size(); + } + return fileCountAvg; + } + + /** + * 对应deleteCount的数据统计平均值 + */ + + public Long getFileSizeAvg() { + Long fileSizeAvg = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + if (item.getEndTime().equals(item.getStartTime())) { + fileSizeAvg += item.getFileSize(); + } else { + fileSizeAvg += item.getFileSize() * 1000 + / (item.getEndTime().getTime() - item.getStartTime().getTime()); + } + } + fileSizeAvg = fileSizeAvg / items.size(); + } + return fileSizeAvg; + } + + /** + * 对应insertCount的数据统计 + */ + public Long getInsertNumber() { + Long insertNumber = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + insertNumber += item.getInsertCount(); + } + } + return insertNumber; + } + + /** + * 对应updateCount的数据统计 + */ + public Long getUpdateNumber() { + Long updateNumber = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + updateNumber += item.getUpdateCount(); + } + } + return updateNumber; + } + + /** + * 对应deleteCount的数据统计 + */ + public Long getDeleteNumber() { + Long deleteNumber = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + deleteNumber += item.getDeleteCount(); + } + } + return deleteNumber; + } + + /** + * 对应fileNumber的数据统计 + */ + public Long getFileNumber() { + Long fileNumber = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + fileNumber += item.getFileCount(); + } + } + return fileNumber; + } + + /** + * 对应fileSize的数据统计 + */ + public Long getFileSize() { + Long fileSize = 0L; + if (items.size() != 0) { + for (TableStat item : items) { + fileSize += item.getFileSize(); + } + } + return fileSize; + } + + // ===================== setter / getter ========================= + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/TimelineBehaviorHistoryCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/TimelineBehaviorHistoryCondition.java index 50b42f60..b928f4f2 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/TimelineBehaviorHistoryCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/table/param/TimelineBehaviorHistoryCondition.java @@ -1,29 +1,43 @@ -package com.alibaba.otter.manager.biz.statistics.table.param; - -import java.util.Date; - -/** - * @author sarah.lij 2012-7-13 下午04:51:55 - */ -public class TimelineBehaviorHistoryCondition extends BehaviorHistoryCondition { - - private Date start; - private Date end; - - public Date getStart() { - return start; - } - - public void setStart(Date start) { - this.start = start; - } - - public Date getEnd() { - return end; - } - - public void setEnd(Date end) { - this.end = end; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.table.param; + +import java.util.Date; + +/** + * @author sarah.lij 2012-7-13 下午04:51:55 + */ +public class TimelineBehaviorHistoryCondition extends BehaviorHistoryCondition { + + private Date start; + private Date end; + + public Date getStart() { + return start; + } + + public void setStart(Date start) { + this.start = start; + } + + public Date getEnd() { + return end; + } + + public void setEnd(Date end) { + this.end = end; + } + +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/ThroughputStatService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/ThroughputStatService.java index ee47e6d8..c0af05f9 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/ThroughputStatService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/ThroughputStatService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ThroughputDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ThroughputDAO.java index 381e46df..3e4060ea 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ThroughputDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ThroughputDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/dataobject/ThroughputStatDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/dataobject/ThroughputStatDO.java index d42ef33b..4cf462fb 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/dataobject/ThroughputStatDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/dataobject/ThroughputStatDO.java @@ -1,104 +1,118 @@ -package com.alibaba.otter.manager.biz.statistics.throughput.dal.dataobject; - -import java.io.Serializable; -import java.util.Date; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author danping.yudp - */ - -public class ThroughputStatDO implements Serializable { - - private static final long serialVersionUID = 1L; - private Long id; - private Long pipelineId; - private Date startTime; - private Date endTime; - private ThroughputType type; - private Long number; - private Long size; - private Date gmtCreate; - private Date gmtModified; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(Long pipelineId) { - this.pipelineId = pipelineId; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public ThroughputType getType() { - return type; - } - - public void setType(ThroughputType type) { - this.type = type; - } - - public Long getNumber() { - return number; - } - - public void setNumber(Long number) { - this.number = number; - } - - public Long getSize() { - return size; - } - - public void setSize(Long size) { - this.size = size; - } - - public Date getGmtCreate() { - return gmtCreate; - } - - public void setGmtCreate(Date gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public Date getGmtModified() { - return gmtModified; - } - - public void setGmtModified(Date gmtModified) { - this.gmtModified = gmtModified; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.biz.statistics.throughput.dal.dataobject; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author danping.yudp + */ + +public class ThroughputStatDO implements Serializable { + + private static final long serialVersionUID = 1L; + private Long id; + private Long pipelineId; + private Date startTime; + private Date endTime; + private ThroughputType type; + private Long number; + private Long size; + private Date gmtCreate; + private Date gmtModified; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(Long pipelineId) { + this.pipelineId = pipelineId; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public ThroughputType getType() { + return type; + } + + public void setType(ThroughputType type) { + this.type = type; + } + + public Long getNumber() { + return number; + } + + public void setNumber(Long number) { + this.number = number; + } + + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + public Date getGmtModified() { + return gmtModified; + } + + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ibatis/IbatisThroughputDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ibatis/IbatisThroughputDAO.java index 968061bb..73ad88be 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ibatis/IbatisThroughputDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/dal/ibatis/IbatisThroughputDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.dal.ibatis; import java.util.HashMap; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/impl/ThroughputStatServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/impl/ThroughputStatServiceImpl.java index 165dcfcc..8d8e8f2b 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/impl/ThroughputStatServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/impl/ThroughputStatServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/AnalysisType.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/AnalysisType.java index 82c09b9c..0a18b6b7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/AnalysisType.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/AnalysisType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.param; /** diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/RealtimeThroughputCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/RealtimeThroughputCondition.java index 82b22cf4..55e153e7 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/RealtimeThroughputCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/RealtimeThroughputCondition.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.param; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputCondition.java index e3ad524a..8621c660 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputCondition.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.param; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputInfo.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputInfo.java index 1ca541a0..95f8db06 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputInfo.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/ThroughputInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.param; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/TimelineThroughputCondition.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/TimelineThroughputCondition.java index 33c919b2..4783745a 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/TimelineThroughputCondition.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/statistics/throughput/param/TimelineThroughputCondition.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.statistics.throughput.param; import java.util.Date; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/UserService.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/UserService.java index 76f1ff0c..6c78dd74 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/UserService.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/UserService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.user; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/UserDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/UserDAO.java index cafa418c..b3332e20 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/UserDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/UserDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.user.dal; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/dataobject/UserDO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/dataobject/UserDO.java index 655882a2..1749dbff 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/dataobject/UserDO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/dataobject/UserDO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.user.dal.dataobject; import java.io.Serializable; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/ibatis/IbatisUserDAO.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/ibatis/IbatisUserDAO.java index cb44f209..b6e5964d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/ibatis/IbatisUserDAO.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/dal/ibatis/IbatisUserDAO.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.user.dal.ibatis; import java.util.List; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/impl/UserServiceImpl.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/impl/UserServiceImpl.java index ea4eebf5..2075a3ab 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/impl/UserServiceImpl.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/user/impl/UserServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.user.impl; import java.util.ArrayList; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/DataSourceChecker.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/DataSourceChecker.java index 9f0e9af0..bbecff8d 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/DataSourceChecker.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/DataSourceChecker.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.utils; import java.sql.Connection; diff --git a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/RegexUtils.java b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/RegexUtils.java index f9e99b31..99f45088 100644 --- a/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/RegexUtils.java +++ b/manager/biz/src/main/java/com/alibaba/otter/manager/biz/utils/RegexUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.utils; import java.util.Map; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/BaseOtterTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/BaseOtterTest.java index ba534d42..22ef217e 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/BaseOtterTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz; import java.util.Map; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollectorTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollectorTest.java index 9a5d6925..d88fa441 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollectorTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollectorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.autokeeper.impl; import java.util.Set; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/AbstractRuleMonitorInPeriodTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/AbstractRuleMonitorInPeriodTest.java index ba1d252a..e70bfaaf 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/AbstractRuleMonitorInPeriodTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/AbstractRuleMonitorInPeriodTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.lang.reflect.Method; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/ExceptionRuleMonitorTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/ExceptionRuleMonitorTest.java index d4eb8406..04936e32 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/ExceptionRuleMonitorTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/ExceptionRuleMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.ArrayList; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/GlobalMonitorTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/GlobalMonitorTest.java index 2f4136ee..0cb9b172 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/GlobalMonitorTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/monitor/GlobalMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.monitor; import java.util.ArrayList; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/NodeSerivceTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/NodeSerivceTest.java index 80c4e73b..c0c3494a 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/NodeSerivceTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/NodeSerivceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.service; import java.util.ArrayList; diff --git a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/PipelineSerivceTest.java b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/PipelineSerivceTest.java index d3c08524..d89d5063 100644 --- a/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/PipelineSerivceTest.java +++ b/manager/biz/src/test/java/com/alibaba/otter/manager/biz/service/PipelineSerivceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.biz.service; import com.alibaba.otter.manager.biz.BaseOtterTest; diff --git a/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/JettyEmbedServer.java b/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/JettyEmbedServer.java index 8659d0d6..f6b01bf2 100644 --- a/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/JettyEmbedServer.java +++ b/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/JettyEmbedServer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.deployer; import org.eclipse.jetty.server.Handler; diff --git a/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/OtterManagerLauncher.java b/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/OtterManagerLauncher.java index b2cf8d91..9a515eb6 100644 --- a/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/OtterManagerLauncher.java +++ b/manager/deployer/src/main/java/com/alibaba/otter/manager/deployer/OtterManagerLauncher.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.deployer; import java.io.FileInputStream; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/NumberFormatUtil.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/NumberFormatUtil.java index 808324f5..c2165883 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/NumberFormatUtil.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/NumberFormatUtil.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common; import java.math.BigDecimal; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/WebConstant.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/WebConstant.java index f5b22f38..186621d6 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/WebConstant.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/WebConstant.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common; /** diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/ApiAuthService.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/ApiAuthService.java index ec3bc2c7..35e1e7cf 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/ApiAuthService.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/ApiAuthService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.api; import com.alibaba.citrus.turbine.TurbineRunData; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/DefaultApiAuthService.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/DefaultApiAuthService.java index a9489875..d16207fd 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/DefaultApiAuthService.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/DefaultApiAuthService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.api; import com.alibaba.citrus.turbine.TurbineRunData; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/JsonResult.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/JsonResult.java index d6da1207..6af45626 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/JsonResult.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/api/JsonResult.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.api; import java.io.Serializable; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorCanal.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorCanal.java index 62aab05c..1ab9db24 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorCanal.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorCanal.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import com.alibaba.otter.canal.instance.manager.model.Canal; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorChannel.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorChannel.java index a5f2b54e..aaed4723 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorChannel.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorChannel.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import com.alibaba.otter.shared.common.model.config.channel.Channel; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMatrix.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMatrix.java index bb98658d..e581fa21 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMatrix.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMatrix.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import com.alibaba.otter.shared.common.model.config.data.DataMatrix; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMedia.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMedia.java index 5e0f9d98..cd93d6da 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMedia.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaPair.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaPair.java index 23b1334f..b04a4cbd 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaPair.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import com.alibaba.otter.shared.common.model.config.channel.Channel; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaSource.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaSource.java index d8780d2f..e8e2700e 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaSource.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorDataMediaSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorNode.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorNode.java index 19e71aa6..239bfdee 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorNode.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/common/model/SeniorNode.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.common.model; import com.alibaba.otter.shared.common.model.config.node.Node; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AbstractAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AbstractAction.java index 2102a074..cedd28f8 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AbstractAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AbstractAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.io.UnsupportedEncodingException; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AlarmRuleAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AlarmRuleAction.java index c49ac1f6..6dea4a8d 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AlarmRuleAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AlarmRuleAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.Arrays; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AutoKeeperClusterAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AutoKeeperClusterAction.java index f8d85b66..3743061e 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AutoKeeperClusterAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/AutoKeeperClusterAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.Arrays; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/CanalAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/CanalAction.java index 1ea3fda3..866dd8b6 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/CanalAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/CanalAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.net.InetSocketAddress; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ChannelAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ChannelAction.java index 28622a06..546b6eae 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ChannelAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ChannelAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairAction.java index 565c2f08..88190ec8 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairGroupAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairGroupAction.java index 8ebf7e95..23f11eaf 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairGroupAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/ColumnPairGroupAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMatrixAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMatrixAction.java index d2e5296e..c568daa5 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMatrixAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMatrixAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaAction.java index a0254403..10f3d08d 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaPairAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaPairAction.java index 313c8a87..1da9a8e8 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaPairAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaPairAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.Arrays; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaSourceAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaSourceAction.java index 7cadf2da..5822c769 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaSourceAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/DataMediaSourceAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/NodeAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/NodeAction.java index d457576a..c27038c7 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/NodeAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/NodeAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PipelineAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PipelineAction.java index 7e0811bc..3872b294 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PipelineAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PipelineAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PositionAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PositionAction.java index ea39b8a0..f8d80cae 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PositionAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/PositionAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SwitchWarmupAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SwitchWarmupAction.java index 07219259..f698c1a7 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SwitchWarmupAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SwitchWarmupAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SystemParameterAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SystemParameterAction.java index c2095452..fd9d6c5f 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SystemParameterAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/SystemParameterAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/UserAction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/UserAction.java index 79fde51a..7a81a14a 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/UserAction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/action/UserAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.action; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddAlarmRule.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddAlarmRule.java index 7ab89aa7..9d5a9014 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddAlarmRule.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddAlarmRule.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddBatchDataMediaPair.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddBatchDataMediaPair.java index a8559189..2ca7f6ba 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddBatchDataMediaPair.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddBatchDataMediaPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddCanal.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddCanal.java index 08316804..c0f7e5d4 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddCanal.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddCanal.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPair.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPair.java index 216f7f9f..840d6ee2 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPair.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPairGroup.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPairGroup.java index 36c29c58..d72c3f3c 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPairGroup.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddColumnPairGroup.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddDataMediaPair.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddDataMediaPair.java index 6f2d142b..012bb712 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddDataMediaPair.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddDataMediaPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddNode.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddNode.java index a719f114..ba36ee3e 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddNode.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddNode.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddPipeline.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddPipeline.java index c95d72e4..86ca6aa8 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddPipeline.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddPipeline.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddZookeeper.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddZookeeper.java index 93e1a25c..63044926 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddZookeeper.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AddZookeeper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmRuleList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmRuleList.java index a8232b8e..b3ad59fd 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmRuleList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmRuleList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmSystemList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmSystemList.java index 75014ee2..a14a2c4b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmSystemList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AlarmSystemList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisDelayStat.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisDelayStat.java index 98324734..2501cd39 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisDelayStat.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisDelayStat.java @@ -1,66 +1,80 @@ -package com.alibaba.otter.manager.web.home.module.screen; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang.StringUtils; - -import com.alibaba.citrus.turbine.Context; -import com.alibaba.citrus.turbine.dataresolver.Param; -import com.alibaba.otter.manager.biz.config.channel.ChannelService; -import com.alibaba.otter.manager.biz.statistics.delay.DelayStatService; -import com.alibaba.otter.manager.biz.statistics.delay.param.DelayStatInfo; -import com.alibaba.otter.shared.common.model.config.channel.Channel; - -public class AnalysisDelayStat { - - @Resource(name = "channelService") - private ChannelService channelService; - - @Resource(name = "delayStatService") - private DelayStatService delayStatService; - - public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, - @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception { - Date end = null; - Date start = null; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) { - start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000); - end = new Date(System.currentTimeMillis() / 60000 * 60000); - } else {// 当前24小时,时间取整分钟 - sdf.setLenient(false); - if (null != startTime && null != endTime) { - start = sdf.parse(startTime); - end = sdf.parse(endTime); - } - } - - Channel channel = channelService.findByPipelineId(pipelineId); - Map delayStatInfos = new HashMap(); - if (null != start && null != end) { - delayStatInfos = delayStatService.listTimelineDelayStat(pipelineId, start, end); - } - - Double delayAvg = 0.0; - for (DelayStatInfo info : delayStatInfos.values()) { - delayAvg += info.getAvgDelayTime(); - } - - if (delayStatInfos.size() != 0) { - delayAvg = delayAvg / (1.0 * delayStatInfos.size()); - } - - context.put("delayStatInfos", delayStatInfos); - context.put("delayAvg", delayAvg); - context.put("channel", channel); - context.put("pipelineId", pipelineId); - context.put("start", sdf.format(start)); - context.put("end", sdf.format(end)); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.web.home.module.screen; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.StringUtils; + +import com.alibaba.citrus.turbine.Context; +import com.alibaba.citrus.turbine.dataresolver.Param; +import com.alibaba.otter.manager.biz.config.channel.ChannelService; +import com.alibaba.otter.manager.biz.statistics.delay.DelayStatService; +import com.alibaba.otter.manager.biz.statistics.delay.param.DelayStatInfo; +import com.alibaba.otter.shared.common.model.config.channel.Channel; + +public class AnalysisDelayStat { + + @Resource(name = "channelService") + private ChannelService channelService; + + @Resource(name = "delayStatService") + private DelayStatService delayStatService; + + public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, + @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception { + Date end = null; + Date start = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) { + start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000); + end = new Date(System.currentTimeMillis() / 60000 * 60000); + } else {// 当前24小时,时间取整分钟 + sdf.setLenient(false); + if (null != startTime && null != endTime) { + start = sdf.parse(startTime); + end = sdf.parse(endTime); + } + } + + Channel channel = channelService.findByPipelineId(pipelineId); + Map delayStatInfos = new HashMap(); + if (null != start && null != end) { + delayStatInfos = delayStatService.listTimelineDelayStat(pipelineId, start, end); + } + + Double delayAvg = 0.0; + for (DelayStatInfo info : delayStatInfos.values()) { + delayAvg += info.getAvgDelayTime(); + } + + if (delayStatInfos.size() != 0) { + delayAvg = delayAvg / (1.0 * delayStatInfos.size()); + } + + context.put("delayStatInfos", delayStatInfos); + context.put("delayAvg", delayAvg); + context.put("channel", channel); + context.put("pipelineId", pipelineId); + context.put("start", sdf.format(start)); + context.put("end", sdf.format(end)); + } +} diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisStageStat.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisStageStat.java index aeb0b752..7fc1d276 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisStageStat.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisStageStat.java @@ -1,126 +1,140 @@ -package com.alibaba.otter.manager.web.home.module.screen; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import com.alibaba.citrus.turbine.Context; -import com.alibaba.citrus.turbine.dataresolver.Param; -import com.alibaba.otter.manager.biz.config.pipeline.PipelineService; -import com.alibaba.otter.manager.biz.statistics.stage.ProcessStatService; -import com.alibaba.otter.shared.arbitrate.ArbitrateViewService; -import com.alibaba.otter.shared.arbitrate.model.MainStemEventData; -import com.alibaba.otter.shared.arbitrate.model.PositionEventData; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; -import com.alibaba.otter.shared.common.model.statistics.stage.ProcessStat; - -public class AnalysisStageStat { - - @Resource(name = "pipelineService") - private PipelineService pipelineService; - - @Resource(name = "processStatService") - private ProcessStatService processStatService; - - @Resource(name = "arbitrateViewService") - private ArbitrateViewService arbitrateViewService; - - public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception { - - List processStats = new ArrayList(); - Pipeline pipeline = pipelineService.findById(pipelineId); - processStats = processStatService.listRealtimeProcessStat(pipelineId); - // Map ext = new HashMap(); - // // ext.put(145456451, "asdf"); - // for (Long i = 1L; i <= 3; i++) { - // List stageStats = new ArrayList(); - // ProcessStat processStat = new ProcessStat(); - // processStat.setPipelineId(1L); - // processStat.setProcessId(i); - // StageStat stage = new StageStat(); - // stage.setStage(StageType.SELECT); - // stage.setStartTime(((new Date()).getTime() + i * 10 * 1000)); - // stage.setEndTime(((new Date()).getTime() + i * 200 * 1000)); - // stage.setNumber(11231230L); - // stage.setSize(14545645640L); - // // stage.setExts(ext); - // stageStats.add(stage); - // stage = new StageStat(); - // stage.setStage(StageType.EXTRACT); - // stage.setStartTime(((new Date()).getTime() + i * 2000 * 1000)); - // stage.setEndTime(((new Date()).getTime() + i * 3000 * 1000)); - // stage.setExts(ext); - // // stage.setNumber(10L); - // // stage.setSize(10L); - // stageStats.add(stage); - // stage = new StageStat(); - // stage.setStage(StageType.TRANSFORM); - // stage.setStartTime(((new Date()).getTime() + i * 5000 * 1000)); - // stage.setEndTime(((new Date()).getTime() + i * 6000 * 1000)); - // stage.setNumber(154640L); - // stage.setExts(ext); - // // stage.setSize(10L); - // stageStats.add(stage); - // stage = new StageStat(); - // stage.setStage(StageType.LOAD); - // stage.setStartTime(((new Date()).getTime() + i * 70000 * 1000)); - // stage.setEndTime(((new Date()).getTime() + i * 80000 * 1000)); - // // stage.setNumber(10L); - // stage.setSize(101445L); - // // stage.setExts(ext); - // stageStats.add(stage); - // processStat.setStageStats(stageStats); - // processStats.add(processStat); - // } - - Long stageStart = 0L; - // Long stageEnd = new Date().getTime() + 3 * 80000 * 1000; - Long stageEnd = new Date().getTime(); - Long interval = 0L; - double offset = 0L; - // 找出最先开始的process的select阶段的开始时间作为起始时间 - if (processStats.size() > 0) { - if (processStats.get(0).getStageStats().size() > 0) { - stageStart = processStats.get(0).getStageStats().get(0).getStartTime(); - } - } - - // 动态计算每个阶段的长度比例 - if (stageStart > 0) { - interval = stageEnd - stageStart; - } - if (interval > 0) { - offset = 800.0 / interval; - } - - // 计算每个process当前任务所做的时间总和 - Map processTime = new HashMap(); - for (ProcessStat processStat : processStats) { - Long timeout = 0L; - if (processStat.getStageStats().size() > 0) { - timeout = stageEnd - processStat.getStageStats().get(0).getStartTime(); - } - processTime.put(processStat.getProcessId(), timeout); - } - - // 获取下mainstem状态信息 - MainStemEventData mainstemData = arbitrateViewService.mainstemData(pipeline.getChannelId(), pipelineId); - - PositionEventData positionData = arbitrateViewService.getCanalCursor(pipeline.getParameters().getDestinationName(), - pipeline.getParameters().getMainstemClientId()); - - context.put("pipeline", pipeline); - context.put("pipelineId", pipelineId); - context.put("processStats", processStats); - context.put("offset", offset); - context.put("stageStart", stageStart); - context.put("stageEnd", stageEnd); - context.put("processTime", processTime); - context.put("mainstemData", mainstemData); - context.put("positionData", positionData); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.web.home.module.screen; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import com.alibaba.citrus.turbine.Context; +import com.alibaba.citrus.turbine.dataresolver.Param; +import com.alibaba.otter.manager.biz.config.pipeline.PipelineService; +import com.alibaba.otter.manager.biz.statistics.stage.ProcessStatService; +import com.alibaba.otter.shared.arbitrate.ArbitrateViewService; +import com.alibaba.otter.shared.arbitrate.model.MainStemEventData; +import com.alibaba.otter.shared.arbitrate.model.PositionEventData; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; +import com.alibaba.otter.shared.common.model.statistics.stage.ProcessStat; + +public class AnalysisStageStat { + + @Resource(name = "pipelineService") + private PipelineService pipelineService; + + @Resource(name = "processStatService") + private ProcessStatService processStatService; + + @Resource(name = "arbitrateViewService") + private ArbitrateViewService arbitrateViewService; + + public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception { + + List processStats = new ArrayList(); + Pipeline pipeline = pipelineService.findById(pipelineId); + processStats = processStatService.listRealtimeProcessStat(pipelineId); + // Map ext = new HashMap(); + // // ext.put(145456451, "asdf"); + // for (Long i = 1L; i <= 3; i++) { + // List stageStats = new ArrayList(); + // ProcessStat processStat = new ProcessStat(); + // processStat.setPipelineId(1L); + // processStat.setProcessId(i); + // StageStat stage = new StageStat(); + // stage.setStage(StageType.SELECT); + // stage.setStartTime(((new Date()).getTime() + i * 10 * 1000)); + // stage.setEndTime(((new Date()).getTime() + i * 200 * 1000)); + // stage.setNumber(11231230L); + // stage.setSize(14545645640L); + // // stage.setExts(ext); + // stageStats.add(stage); + // stage = new StageStat(); + // stage.setStage(StageType.EXTRACT); + // stage.setStartTime(((new Date()).getTime() + i * 2000 * 1000)); + // stage.setEndTime(((new Date()).getTime() + i * 3000 * 1000)); + // stage.setExts(ext); + // // stage.setNumber(10L); + // // stage.setSize(10L); + // stageStats.add(stage); + // stage = new StageStat(); + // stage.setStage(StageType.TRANSFORM); + // stage.setStartTime(((new Date()).getTime() + i * 5000 * 1000)); + // stage.setEndTime(((new Date()).getTime() + i * 6000 * 1000)); + // stage.setNumber(154640L); + // stage.setExts(ext); + // // stage.setSize(10L); + // stageStats.add(stage); + // stage = new StageStat(); + // stage.setStage(StageType.LOAD); + // stage.setStartTime(((new Date()).getTime() + i * 70000 * 1000)); + // stage.setEndTime(((new Date()).getTime() + i * 80000 * 1000)); + // // stage.setNumber(10L); + // stage.setSize(101445L); + // // stage.setExts(ext); + // stageStats.add(stage); + // processStat.setStageStats(stageStats); + // processStats.add(processStat); + // } + + Long stageStart = 0L; + // Long stageEnd = new Date().getTime() + 3 * 80000 * 1000; + Long stageEnd = new Date().getTime(); + Long interval = 0L; + double offset = 0L; + // 找出最先开始的process的select阶段的开始时间作为起始时间 + if (processStats.size() > 0) { + if (processStats.get(0).getStageStats().size() > 0) { + stageStart = processStats.get(0).getStageStats().get(0).getStartTime(); + } + } + + // 动态计算每个阶段的长度比例 + if (stageStart > 0) { + interval = stageEnd - stageStart; + } + if (interval > 0) { + offset = 800.0 / interval; + } + + // 计算每个process当前任务所做的时间总和 + Map processTime = new HashMap(); + for (ProcessStat processStat : processStats) { + Long timeout = 0L; + if (processStat.getStageStats().size() > 0) { + timeout = stageEnd - processStat.getStageStats().get(0).getStartTime(); + } + processTime.put(processStat.getProcessId(), timeout); + } + + // 获取下mainstem状态信息 + MainStemEventData mainstemData = arbitrateViewService.mainstemData(pipeline.getChannelId(), pipelineId); + + PositionEventData positionData = arbitrateViewService.getCanalCursor(pipeline.getParameters().getDestinationName(), + pipeline.getParameters().getMainstemClientId()); + + context.put("pipeline", pipeline); + context.put("pipelineId", pipelineId); + context.put("processStats", processStats); + context.put("offset", offset); + context.put("stageStart", stageStart); + context.put("stageEnd", stageEnd); + context.put("processTime", processTime); + context.put("mainstemData", mainstemData); + context.put("positionData", positionData); + } +} diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputHistory.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputHistory.java index 60a4c144..1ce45bec 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputHistory.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputHistory.java @@ -1,89 +1,103 @@ -package com.alibaba.otter.manager.web.home.module.screen; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.annotation.Resource; -import javax.servlet.http.HttpSession; - -import org.apache.commons.lang.StringUtils; - -import com.alibaba.citrus.turbine.Context; -import com.alibaba.citrus.turbine.dataresolver.Param; -import com.alibaba.otter.manager.biz.config.channel.ChannelService; -import com.alibaba.otter.manager.biz.statistics.throughput.ThroughputStatService; -import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo; -import com.alibaba.otter.manager.biz.statistics.throughput.param.TimelineThroughputCondition; -import com.alibaba.otter.shared.common.model.config.channel.Channel; -import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; - -public class AnalysisThroughputHistory { - - @Resource(name = "channelService") - private ChannelService channelService; - - @Resource(name = "throughputStatService") - private ThroughputStatService throughputStatService; - - public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, - @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception { - Date end = null; - Date start = null; - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) { - start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000); - end = new Date(System.currentTimeMillis() / 60000 * 60000); - } else {// 当前24小时,时间取整分钟 - sdf.setLenient(false); - if (null != startTime && null != endTime) { - start = sdf.parse(startTime); - end = sdf.parse(endTime); - } - } - - Channel channel = channelService.findByPipelineId(pipelineId); - Map throughputInfos1 = new LinkedHashMap(); - Map throughputInfos2 = new LinkedHashMap(); - TimelineThroughputCondition condition1 = new TimelineThroughputCondition(); - TimelineThroughputCondition condition2 = new TimelineThroughputCondition(); - if (null != start && null != end) { - condition1.setStart(start); - condition1.setEnd(end); - condition1.setType(ThroughputType.ROW); - condition1.setPipelineId(pipelineId); - condition2.setStart(start); - condition2.setEnd(end); - condition2.setType(ThroughputType.FILE); - condition2.setPipelineId(pipelineId); - throughputInfos1 = throughputStatService.listTimelineThroughput(condition1); - throughputInfos2 = throughputStatService.listTimelineThroughput(condition2); - } - - Long totalRecord1 = 0L; - Long totalRecord2 = 0L; - Long totalSize1 = 0L; - Long totalSize2 = 0L; - for (ThroughputInfo info : throughputInfos1.values()) { - totalRecord1 += info.getNumber(); - totalSize1 += info.getSize(); - } - - for (ThroughputInfo info : throughputInfos2.values()) { - totalRecord2 += info.getNumber(); - totalSize2 += info.getSize(); - } - - context.put("throughputInfos1", throughputInfos1); - context.put("throughputInfos2", throughputInfos2); - context.put("totalRecord1", totalRecord1); - context.put("totalRecord2", totalRecord2); - context.put("totalSize1", totalSize1); - context.put("totalSize2", totalSize2); - context.put("channel", channel); - context.put("pipelineId", pipelineId); - context.put("start", sdf.format(start)); - context.put("end", sdf.format(end)); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.web.home.module.screen; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.StringUtils; + +import com.alibaba.citrus.turbine.Context; +import com.alibaba.citrus.turbine.dataresolver.Param; +import com.alibaba.otter.manager.biz.config.channel.ChannelService; +import com.alibaba.otter.manager.biz.statistics.throughput.ThroughputStatService; +import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo; +import com.alibaba.otter.manager.biz.statistics.throughput.param.TimelineThroughputCondition; +import com.alibaba.otter.shared.common.model.config.channel.Channel; +import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; + +public class AnalysisThroughputHistory { + + @Resource(name = "channelService") + private ChannelService channelService; + + @Resource(name = "throughputStatService") + private ThroughputStatService throughputStatService; + + public void execute(@Param("d5221") String startTime, @Param("d5222") String endTime, + @Param("pipelineId") Long pipelineId, HttpSession session, Context context) throws Exception { + Date end = null; + Date start = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) { + start = new Date(System.currentTimeMillis() / 60000 * 60000 - 24 * 60 * 60 * 1000); + end = new Date(System.currentTimeMillis() / 60000 * 60000); + } else {// 当前24小时,时间取整分钟 + sdf.setLenient(false); + if (null != startTime && null != endTime) { + start = sdf.parse(startTime); + end = sdf.parse(endTime); + } + } + + Channel channel = channelService.findByPipelineId(pipelineId); + Map throughputInfos1 = new LinkedHashMap(); + Map throughputInfos2 = new LinkedHashMap(); + TimelineThroughputCondition condition1 = new TimelineThroughputCondition(); + TimelineThroughputCondition condition2 = new TimelineThroughputCondition(); + if (null != start && null != end) { + condition1.setStart(start); + condition1.setEnd(end); + condition1.setType(ThroughputType.ROW); + condition1.setPipelineId(pipelineId); + condition2.setStart(start); + condition2.setEnd(end); + condition2.setType(ThroughputType.FILE); + condition2.setPipelineId(pipelineId); + throughputInfos1 = throughputStatService.listTimelineThroughput(condition1); + throughputInfos2 = throughputStatService.listTimelineThroughput(condition2); + } + + Long totalRecord1 = 0L; + Long totalRecord2 = 0L; + Long totalSize1 = 0L; + Long totalSize2 = 0L; + for (ThroughputInfo info : throughputInfos1.values()) { + totalRecord1 += info.getNumber(); + totalSize1 += info.getSize(); + } + + for (ThroughputInfo info : throughputInfos2.values()) { + totalRecord2 += info.getNumber(); + totalSize2 += info.getSize(); + } + + context.put("throughputInfos1", throughputInfos1); + context.put("throughputInfos2", throughputInfos2); + context.put("totalRecord1", totalRecord1); + context.put("totalRecord2", totalRecord2); + context.put("totalSize1", totalSize1); + context.put("totalSize2", totalSize2); + context.put("channel", channel); + context.put("pipelineId", pipelineId); + context.put("start", sdf.format(start)); + context.put("end", sdf.format(end)); + } +} diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputStat.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputStat.java index 0d0e3e8e..7711bded 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputStat.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisThroughputStat.java @@ -1,64 +1,78 @@ -package com.alibaba.otter.manager.web.home.module.screen; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import com.alibaba.citrus.turbine.Context; -import com.alibaba.citrus.turbine.dataresolver.Param; -import com.alibaba.otter.shared.common.model.config.channel.Channel; -import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat; -import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; -import com.alibaba.otter.manager.biz.config.channel.ChannelService; -import com.alibaba.otter.manager.biz.statistics.throughput.ThroughputStatService; -import com.alibaba.otter.manager.biz.statistics.throughput.param.AnalysisType; -import com.alibaba.otter.manager.biz.statistics.throughput.param.RealtimeThroughputCondition; -import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputCondition; -import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo; - -public class AnalysisThroughputStat { - - @Resource(name = "throughputStatService") - private ThroughputStatService throughputStatService; - - @Resource(name = "channelService") - private ChannelService channelService; - - public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception { - Channel channel = channelService.findByPipelineId(pipelineId); - RealtimeThroughputCondition condition1 = new RealtimeThroughputCondition(); - RealtimeThroughputCondition condition2 = new RealtimeThroughputCondition(); - ThroughputCondition condition11 = new ThroughputCondition(); - ThroughputCondition condition22 = new ThroughputCondition(); - List analysisType = new ArrayList(); - analysisType.add(AnalysisType.ONE_MINUTE); - analysisType.add(AnalysisType.FIVE_MINUTE); - analysisType.add(AnalysisType.FIFTEEN_MINUTE); - condition1.setPipelineId(pipelineId); - condition1.setAnalysisType(analysisType); - condition1.setType(ThroughputType.FILE); - condition2.setPipelineId(pipelineId); - condition2.setAnalysisType(analysisType); - condition2.setType(ThroughputType.ROW); - condition11.setPipelineId(pipelineId); - condition11.setType(ThroughputType.FILE); - condition22.setPipelineId(pipelineId); - condition22.setType(ThroughputType.ROW); - Map throughputInfos1 = throughputStatService.listRealtimeThroughput(condition1); - Map throughputInfos2 = throughputStatService.listRealtimeThroughput(condition2); - ThroughputStat throughputStat1 = throughputStatService.findThroughputStatByPipelineId(condition11); - ThroughputStat throughputStat2 = throughputStatService.findThroughputStatByPipelineId(condition22); - - context.put("throughputInfos1", throughputInfos1); - context.put("throughputInfos2", throughputInfos2); - context.put("channel", channel); - context.put("pipelineId", pipelineId); - context.put("throughputStat1", throughputStat1); - context.put("throughputStat2", throughputStat2); - context.put("one", AnalysisType.ONE_MINUTE); - context.put("five", AnalysisType.FIVE_MINUTE); - context.put("fifteen", AnalysisType.FIFTEEN_MINUTE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.manager.web.home.module.screen; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import com.alibaba.citrus.turbine.Context; +import com.alibaba.citrus.turbine.dataresolver.Param; +import com.alibaba.otter.shared.common.model.config.channel.Channel; +import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputStat; +import com.alibaba.otter.shared.common.model.statistics.throughput.ThroughputType; +import com.alibaba.otter.manager.biz.config.channel.ChannelService; +import com.alibaba.otter.manager.biz.statistics.throughput.ThroughputStatService; +import com.alibaba.otter.manager.biz.statistics.throughput.param.AnalysisType; +import com.alibaba.otter.manager.biz.statistics.throughput.param.RealtimeThroughputCondition; +import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputCondition; +import com.alibaba.otter.manager.biz.statistics.throughput.param.ThroughputInfo; + +public class AnalysisThroughputStat { + + @Resource(name = "throughputStatService") + private ThroughputStatService throughputStatService; + + @Resource(name = "channelService") + private ChannelService channelService; + + public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception { + Channel channel = channelService.findByPipelineId(pipelineId); + RealtimeThroughputCondition condition1 = new RealtimeThroughputCondition(); + RealtimeThroughputCondition condition2 = new RealtimeThroughputCondition(); + ThroughputCondition condition11 = new ThroughputCondition(); + ThroughputCondition condition22 = new ThroughputCondition(); + List analysisType = new ArrayList(); + analysisType.add(AnalysisType.ONE_MINUTE); + analysisType.add(AnalysisType.FIVE_MINUTE); + analysisType.add(AnalysisType.FIFTEEN_MINUTE); + condition1.setPipelineId(pipelineId); + condition1.setAnalysisType(analysisType); + condition1.setType(ThroughputType.FILE); + condition2.setPipelineId(pipelineId); + condition2.setAnalysisType(analysisType); + condition2.setType(ThroughputType.ROW); + condition11.setPipelineId(pipelineId); + condition11.setType(ThroughputType.FILE); + condition22.setPipelineId(pipelineId); + condition22.setType(ThroughputType.ROW); + Map throughputInfos1 = throughputStatService.listRealtimeThroughput(condition1); + Map throughputInfos2 = throughputStatService.listRealtimeThroughput(condition2); + ThroughputStat throughputStat1 = throughputStatService.findThroughputStatByPipelineId(condition11); + ThroughputStat throughputStat2 = throughputStatService.findThroughputStatByPipelineId(condition22); + + context.put("throughputInfos1", throughputInfos1); + context.put("throughputInfos2", throughputInfos2); + context.put("channel", channel); + context.put("pipelineId", pipelineId); + context.put("throughputStat1", throughputStat1); + context.put("throughputStat2", throughputStat2); + context.put("one", AnalysisType.ONE_MINUTE); + context.put("five", AnalysisType.FIVE_MINUTE); + context.put("fifteen", AnalysisType.FIFTEEN_MINUTE); + } +} diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisTopStat.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisTopStat.java index 77fc4ff3..81dc84ca 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisTopStat.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AnalysisTopStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClientPath.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClientPath.java index b0f3c325..a4ca973a 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClientPath.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClientPath.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashSet; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersDetail.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersDetail.java index f0436274..54068dd5 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersDetail.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersDetail.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersList.java index 89e64a8c..218eba57 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/AutoKeeperClustersList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/BehaviorHistoryCurve.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/BehaviorHistoryCurve.java index 2d235cf4..3e5f37d2 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/BehaviorHistoryCurve.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/BehaviorHistoryCurve.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.text.SimpleDateFormat; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalInfo.java index a37f567a..b6bd37aa 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalList.java index a7505e21..5805082a 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CanalList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelInfo.java index b90fb948..b247ea7f 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelList.java index 269a38d6..1bf2d03f 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/ChannelList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CheckDelayStat.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CheckDelayStat.java index 271560b0..56921772 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CheckDelayStat.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/CheckDelayStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.Date; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixInfo.java index 820736df..5ab0720a 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixList.java index c6ac0952..73fc5d80 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMatrixList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaInfo.java index e98d7152..da2fa33f 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaList.java index 1977c0b4..8d2dafd7 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairInfo.java index 244bc91d..db208ff1 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairList.java index e5ccd416..d5960fbd 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataMediaPairList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceInfo.java index 80f1f7f0..bb6e29a7 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceList.java index f03767b3..e958265b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/DataSourceList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAlarmRule.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAlarmRule.java index 9ae02d13..3ef3ea82 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAlarmRule.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAlarmRule.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAutoKeeper.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAutoKeeper.java index 343c0920..783a56ed 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAutoKeeper.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditAutoKeeper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditCanal.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditCanal.java index 391a42da..c7ed8a34 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditCanal.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditCanal.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditChannel.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditChannel.java index 38b71bd4..d41e6ef4 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditChannel.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditChannel.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMatrix.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMatrix.java index 8e7a027f..1b5a32d9 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMatrix.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMatrix.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMedia.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMedia.java index 79598dca..9e8ca8d1 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMedia.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMediaPair.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMediaPair.java index 60c43ff9..abd3d64b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMediaPair.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataMediaPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataSource.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataSource.java index 4e65761f..21c34d19 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataSource.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditDataSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditNode.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditNode.java index c8bc751d..1f80fc43 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditNode.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditNode.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditPipeline.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditPipeline.java index d0bb2ad4..1be2e862 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditPipeline.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditPipeline.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditUser.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditUser.java index 39767e0d..e385afaf 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditUser.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/EditUser.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordList.java index 3c4c4fd1..0e1e3fac 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordTab.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordTab.java index f53978ac..7bccad20 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordTab.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/LogRecordTab.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeInfo.java index b4f5e5c1..e6ce5637 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeList.java index b9760a1c..4ebbe69b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/NodeList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/Ok.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/Ok.java index 2824cb04..396611d4 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/Ok.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/Ok.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import com.alibaba.citrus.turbine.Context; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineInfo.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineInfo.java index a2458f19..8d810490 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineInfo.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineList.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineList.java index 23954f2b..e7037c1b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineList.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/PipelineList.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectCanal.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectCanal.java index f2053c1f..9ad53f83 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectCanal.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectCanal.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataMedia.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataMedia.java index d018473e..51e64b2d 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataMedia.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataSource.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataSource.java index 41ccc877..5156f3ba 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataSource.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SelectDataSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemParameter.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemParameter.java index 1d3bf693..5bb65ee2 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemParameter.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemReduction.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemReduction.java index bb274037..dc3321bf 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemReduction.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/SystemReduction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/UserManager.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/UserManager.java index 91a6db4f..2c0ac104 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/UserManager.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/UserManager.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen; import java.util.HashMap; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/AbstractJsonScreen.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/AbstractJsonScreen.java index b5145024..278a09e4 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/AbstractJsonScreen.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/AbstractJsonScreen.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.api; import java.io.IOException; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelCheck.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelCheck.java index 86203177..2afb9076 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelCheck.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelCheck.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.api; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelOp.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelOp.java index fe7ef36a..29155f3c 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelOp.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/ChannelOp.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.api; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/NodeOp.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/NodeOp.java index f515f23b..48dc9b84 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/NodeOp.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/NodeOp.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.api; import java.util.List; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/TopDelay.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/TopDelay.java index 218043a2..bb8c2d1c 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/TopDelay.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/api/TopDelay.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.api; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/monitor/MonitorTrigger.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/monitor/MonitorTrigger.java index b4f5b4ce..7bc7c11b 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/monitor/MonitorTrigger.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/home/module/screen/monitor/MonitorTrigger.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.home.module.screen.monitor; import javax.annotation.Resource; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/AuthContextValve.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/AuthContextValve.java index c8835046..a7d7629f 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/AuthContextValve.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/AuthContextValve.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve; import static com.alibaba.citrus.turbine.util.TurbineUtil.getTurbineRunData; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/PrepareExceptionValve.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/PrepareExceptionValve.java index c6d608aa..aee28de7 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/PrepareExceptionValve.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/PrepareExceptionValve.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve; import javax.servlet.http.HttpServletRequest; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/AuthorizeProtected.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/AuthorizeProtected.java index 14783f3c..89c05f49 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/AuthorizeProtected.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/AuthorizeProtected.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth; import com.alibaba.otter.manager.web.webx.valve.auth.action.ActionProtected; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/RegExpURLAnalyze.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/RegExpURLAnalyze.java index 1c2d810e..88ee6404 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/RegExpURLAnalyze.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/RegExpURLAnalyze.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth; import java.util.ArrayList; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionPatternHolder.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionPatternHolder.java index f61ae430..6a45c577 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionPatternHolder.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionPatternHolder.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.action; import org.apache.oro.text.regex.Pattern; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtected.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtected.java index d0ff9326..3a79df6e 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtected.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtected.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.action; /** diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedEditor.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedEditor.java index 06574edf..6829fa96 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedEditor.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedEditor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.action; import java.beans.PropertyEditorSupport; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedImpl.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedImpl.java index cc1fd57c..d984cfa5 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedImpl.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/action/ActionProtectedImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.action; import static com.alibaba.citrus.util.StringUtil.trimToNull; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLPatternHolder.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLPatternHolder.java index 9d791c6f..86f39c3c 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLPatternHolder.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLPatternHolder.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.url; import org.apache.oro.text.regex.Pattern; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtected.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtected.java index 76068eca..2fb211de 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtected.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtected.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.url; /** diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedEditor.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedEditor.java index 8df1cef6..2318bc54 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedEditor.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedEditor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.url; import java.beans.PropertyEditorSupport; diff --git a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedImpl.java b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedImpl.java index a0c8e172..f6181123 100644 --- a/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedImpl.java +++ b/manager/web/src/main/java/com/alibaba/otter/manager/web/webx/valve/auth/url/URLProtectedImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.manager.web.webx.valve.auth.url; import java.util.ArrayList; diff --git a/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalCommmunicationClient.java b/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalCommmunicationClient.java index 9dc05664..e083425f 100644 --- a/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalCommmunicationClient.java +++ b/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalCommmunicationClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.canal.extend.communication; import java.util.Arrays; diff --git a/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalConfigClient.java b/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalConfigClient.java index 0d120d0b..b681dec1 100644 --- a/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalConfigClient.java +++ b/node/canal/src/main/java/com/alibaba/otter/canal/extend/communication/CanalConfigClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.canal.extend.communication; import com.alibaba.otter.canal.common.CanalException; diff --git a/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/AuthenticationInfoUtils.java b/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/AuthenticationInfoUtils.java index 7fb2ba21..88335875 100644 --- a/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/AuthenticationInfoUtils.java +++ b/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/AuthenticationInfoUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.canal.extend.ha; import org.apache.commons.beanutils.BeanUtils; diff --git a/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/MediaHAController.java b/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/MediaHAController.java index bcb11029..76b7527d 100644 --- a/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/MediaHAController.java +++ b/node/canal/src/main/java/com/alibaba/otter/canal/extend/ha/MediaHAController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.canal.extend.ha; import org.apache.commons.lang.StringUtils; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommmunicationClient.java b/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommmunicationClient.java index d121a081..1664da63 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommmunicationClient.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommmunicationClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.communication; import java.util.Arrays; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommunicationEndpoint.java b/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommunicationEndpoint.java index b8021fcb..a5e57935 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommunicationEndpoint.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/communication/NodeCommunicationEndpoint.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.communication; import org.springframework.beans.factory.DisposableBean; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/ConfigClientService.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/ConfigClientService.java index f89029cf..6897eda9 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/ConfigClientService.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/ConfigClientService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import com.alibaba.otter.shared.arbitrate.impl.config.ArbitrateConfig; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskListener.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskListener.java index 4b218f0d..07c9882a 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskListener.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import java.util.List; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskService.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskService.java index 2ab24857..8e1109a8 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskService.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/NodeTaskService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import java.util.List; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/ConfigClientServiceImpl.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/ConfigClientServiceImpl.java index 37a1e2e9..34dd10ff 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/ConfigClientServiceImpl.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/ConfigClientServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config.impl; import java.util.List; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/InternalConfigClientService.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/InternalConfigClientService.java index 80dcd64c..f3e9dc5c 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/InternalConfigClientService.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/InternalConfigClientService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config.impl; import com.alibaba.otter.node.common.config.ConfigClientService; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/NodeTaskServiceImpl.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/NodeTaskServiceImpl.java index 19b919dc..deba4406 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/NodeTaskServiceImpl.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/impl/NodeTaskServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config.impl; import java.util.ArrayList; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/config/model/NodeTask.java b/node/common/src/main/java/com/alibaba/otter/node/common/config/model/NodeTask.java index 07698f98..d8f9c3df 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/config/model/NodeTask.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/config/model/NodeTask.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config.model; import java.io.Serializable; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/statistics/StatisticsClientService.java b/node/common/src/main/java/com/alibaba/otter/node/common/statistics/StatisticsClientService.java index 27b4615a..0ba83365 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/statistics/StatisticsClientService.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/statistics/StatisticsClientService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.statistics; import java.util.List; diff --git a/node/common/src/main/java/com/alibaba/otter/node/common/statistics/impl/StatisticsClientServiceImpl.java b/node/common/src/main/java/com/alibaba/otter/node/common/statistics/impl/StatisticsClientServiceImpl.java index 01cf25b6..f33fbf71 100644 --- a/node/common/src/main/java/com/alibaba/otter/node/common/statistics/impl/StatisticsClientServiceImpl.java +++ b/node/common/src/main/java/com/alibaba/otter/node/common/statistics/impl/StatisticsClientServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.statistics.impl; import java.util.List; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/ArbitrateRemoteServiceIntegration.java b/node/common/src/test/java/com/alibaba/otter/node/common/ArbitrateRemoteServiceIntegration.java index 2c540f74..ff11d730 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/ArbitrateRemoteServiceIntegration.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/ArbitrateRemoteServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common; import java.util.concurrent.TimeUnit; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/BaseOtterTest.java b/node/common/src/test/java/com/alibaba/otter/node/common/BaseOtterTest.java index 435e46d4..500ac8fb 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/BaseOtterTest.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common; import org.jtester.annotations.SpringApplicationContext; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceIntegration.java b/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceIntegration.java index a5749bc2..5e52e76b 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceIntegration.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import org.jtester.annotations.SpringBeanByName; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceTest.java b/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceTest.java index 3a1bd8f2..25ef8288 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceTest.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/config/ConfigClientServiceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import java.util.Arrays; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceIntegration.java b/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceIntegration.java index 15c63c14..b6e8461c 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceIntegration.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import java.util.List; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceTest.java b/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceTest.java index 1444ab67..bb457bb3 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceTest.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/config/NodeTaskServiceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.config; import java.util.Arrays; diff --git a/node/common/src/test/java/com/alibaba/otter/node/common/statistics/StatisticsClientServiceIntegration.java b/node/common/src/test/java/com/alibaba/otter/node/common/statistics/StatisticsClientServiceIntegration.java index a6f849b5..240003ea 100644 --- a/node/common/src/test/java/com/alibaba/otter/node/common/statistics/StatisticsClientServiceIntegration.java +++ b/node/common/src/test/java/com/alibaba/otter/node/common/statistics/StatisticsClientServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.common.statistics; import java.util.Arrays; diff --git a/node/deployer/src/main/java/com/alibaba/otter/node/deployer/OtterLauncher.java b/node/deployer/src/main/java/com/alibaba/otter/node/deployer/OtterLauncher.java index 64e5ad00..f846926f 100644 --- a/node/deployer/src/main/java/com/alibaba/otter/node/deployer/OtterLauncher.java +++ b/node/deployer/src/main/java/com/alibaba/otter/node/deployer/OtterLauncher.java @@ -1,54 +1,68 @@ -package com.alibaba.otter.node.deployer; - -import org.apache.commons.lang.exception.ExceptionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.etl.OtterContextLocator; -import com.alibaba.otter.node.etl.OtterController; - -/** - * load otter task to sync data with some pipeline. - * - * @author xiaoqing.zhouxq 2011-8-29 上午10:02:04 - */ -public class OtterLauncher { - - private static final Logger logger = LoggerFactory.getLogger(OtterLauncher.class); - - public static void main(String[] args) throws Throwable { - // 启动dragoon client - startDragoon(); - logger.info("INFO ## the dragoon is start now ......"); - - final OtterController controller = OtterContextLocator.getOtterController(); - controller.start(); - try { - logger.info("INFO ## the otter server is running now ......"); - Runtime.getRuntime().addShutdownHook(new Thread() { - - public void run() { - try { - logger.info("INFO ## stop the otter server"); - controller.stop(); - } catch (Throwable e) { - logger.warn("WARN ##something goes wrong when stopping Otter Server:\n{}", - ExceptionUtils.getFullStackTrace(e)); - } finally { - logger.info("INFO ## otter server is down."); - } - } - - }); - } catch (Throwable e) { - logger.error("ERROR ## Something goes wrong when starting up the Otter Server:\n{}", - ExceptionUtils.getFullStackTrace(e)); - System.exit(0); - } - } - - // 启动dragoon client - private static void startDragoon() { - // do nothing - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.deployer; + +import org.apache.commons.lang.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.etl.OtterContextLocator; +import com.alibaba.otter.node.etl.OtterController; + +/** + * load otter task to sync data with some pipeline. + * + * @author xiaoqing.zhouxq 2011-8-29 上午10:02:04 + */ +public class OtterLauncher { + + private static final Logger logger = LoggerFactory.getLogger(OtterLauncher.class); + + public static void main(String[] args) throws Throwable { + // 启动dragoon client + startDragoon(); + logger.info("INFO ## the dragoon is start now ......"); + + final OtterController controller = OtterContextLocator.getOtterController(); + controller.start(); + try { + logger.info("INFO ## the otter server is running now ......"); + Runtime.getRuntime().addShutdownHook(new Thread() { + + public void run() { + try { + logger.info("INFO ## stop the otter server"); + controller.stop(); + } catch (Throwable e) { + logger.warn("WARN ##something goes wrong when stopping Otter Server:\n{}", + ExceptionUtils.getFullStackTrace(e)); + } finally { + logger.info("INFO ## otter server is down."); + } + } + + }); + } catch (Throwable e) { + logger.error("ERROR ## Something goes wrong when starting up the Otter Server:\n{}", + ExceptionUtils.getFullStackTrace(e)); + System.exit(0); + } + } + + // 启动dragoon client + private static void startDragoon() { + // do nothing + } +} diff --git a/node/deployer/src/test/java/com/alibaba/otter/node/deployer/OtterLauncherIntegration.java b/node/deployer/src/test/java/com/alibaba/otter/node/deployer/OtterLauncherIntegration.java index a823473d..501fab4f 100644 --- a/node/deployer/src/test/java/com/alibaba/otter/node/deployer/OtterLauncherIntegration.java +++ b/node/deployer/src/test/java/com/alibaba/otter/node/deployer/OtterLauncherIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.deployer; import java.util.concurrent.CountDownLatch; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterConstants.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterConstants.java index d186d0e7..8f191393 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterConstants.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterConstants.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterContextLocator.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterContextLocator.java index fe470479..ec57d6a7 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterContextLocator.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterContextLocator.java @@ -1,66 +1,80 @@ -package com.alibaba.otter.node.etl; - -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.alibaba.otter.shared.common.model.config.ConfigException; - -/** - * Comment of OtterServiceLocator - * - * @author xiaoqing.zhouxq - * @author zebin.xuzb 重写 customizeBeanFactory,防止重复id - */ -public class OtterContextLocator { - - private static ClassPathXmlApplicationContext context = null; - private static RuntimeException initException = null; - - static { - try { - context = new ClassPathXmlApplicationContext("applicationContext.xml") { - - @Override - protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) { - super.customizeBeanFactory(beanFactory); - beanFactory.setAllowBeanDefinitionOverriding(false); - } - }; - } catch (RuntimeException e) { - throw new ConfigException("ERROR ## ", e); - } - } - - private static ApplicationContext getApplicationContext() { - if (context == null) { - throw initException; - } - - return context; - } - - public static void close() { - ((ClassPathXmlApplicationContext) context).close(); - } - - public static OtterController getOtterController() { - return (OtterController) getApplicationContext().getBean("otterController"); - } - - public static T getBean(String name) { - return (T) getApplicationContext().getBean(name); - } - - /** - * 根据当前spring容器的bean定义,解析对应的object并完成注入 - */ - public static void autowire(Object obj) { - // 重新注入一下对象 - context.getAutowireCapableBeanFactory().autowireBeanProperties(obj, - AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, - false); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl; + +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import com.alibaba.otter.shared.common.model.config.ConfigException; + +/** + * Comment of OtterServiceLocator + * + * @author xiaoqing.zhouxq + * @author zebin.xuzb 重写 customizeBeanFactory,防止重复id + */ +public class OtterContextLocator { + + private static ClassPathXmlApplicationContext context = null; + private static RuntimeException initException = null; + + static { + try { + context = new ClassPathXmlApplicationContext("applicationContext.xml") { + + @Override + protected void customizeBeanFactory(DefaultListableBeanFactory beanFactory) { + super.customizeBeanFactory(beanFactory); + beanFactory.setAllowBeanDefinitionOverriding(false); + } + }; + } catch (RuntimeException e) { + throw new ConfigException("ERROR ## ", e); + } + } + + private static ApplicationContext getApplicationContext() { + if (context == null) { + throw initException; + } + + return context; + } + + public static void close() { + ((ClassPathXmlApplicationContext) context).close(); + } + + public static OtterController getOtterController() { + return (OtterController) getApplicationContext().getBean("otterController"); + } + + public static T getBean(String name) { + return (T) getApplicationContext().getBean(name); + } + + /** + * 根据当前spring容器的bean定义,解析对应的object并完成注入 + */ + public static void autowire(Object obj) { + // 重新注入一下对象 + context.getAutowireCapableBeanFactory().autowireBeanProperties(obj, + AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, + false); + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterController.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterController.java index dd5d1d96..4aa3bd60 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterController.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterController.java @@ -1,400 +1,414 @@ -package com.alibaba.otter.node.etl; - -import java.lang.management.ManagementFactory; -import java.lang.management.MemoryUsage; -import java.lang.management.OperatingSystemMXBean; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadPoolExecutor; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.common.config.NodeTaskListener; -import com.alibaba.otter.node.common.config.NodeTaskService; -import com.alibaba.otter.node.common.config.model.NodeTask; -import com.alibaba.otter.node.common.config.model.NodeTask.TaskEvent; -import com.alibaba.otter.node.etl.common.datasource.DataSourceService; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; -import com.alibaba.otter.node.etl.common.jmx.StageAggregationCollector; -import com.alibaba.otter.node.etl.common.task.GlobalTask; -import com.alibaba.otter.node.etl.extract.ExtractTask; -import com.alibaba.otter.node.etl.load.LoadTask; -import com.alibaba.otter.node.etl.select.SelectTask; -import com.alibaba.otter.node.etl.transform.TransformTask; -import com.alibaba.otter.shared.arbitrate.ArbitrateEventService; -import com.alibaba.otter.shared.arbitrate.ArbitrateManageService; -import com.alibaba.otter.shared.arbitrate.impl.manage.NodeSessionExpired; -import com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient; -import com.alibaba.otter.shared.common.model.config.ConfigException; -import com.alibaba.otter.shared.common.model.config.enums.StageType; -import com.alibaba.otter.shared.common.model.config.node.Node; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; -import com.alibaba.otter.shared.common.utils.AddressUtils; -import com.alibaba.otter.shared.common.utils.JsonUtils; -import com.alibaba.otter.shared.common.utils.version.VersionInfo; -import com.google.common.base.Function; -import com.google.common.collect.MapMaker; - -/** - * 管理和维护对应node机器内的S.E.T.L任务,实时接收manager推送的NodeTask调度信息,可查看 {@linkplain NodeTaskService} - * - * @author jianghang 2012-4-21 下午04:48:12 - * @version 4.0.2 - */ -public class OtterController implements NodeTaskListener, OtterControllerMBean { - - private static final Logger logger = LoggerFactory.getLogger(OtterController.class); - - // 第一层为pipelineId,第二层为S.E.T.L模块 - private Map> controllers = new MapMaker().makeComputingMap(new Function>() { - - public Map apply(Long pipelineId) { - return new MapMaker().makeMap(); - } - }); - private ConfigClientService configClientService; - private ArbitrateManageService arbitrateManageService; - private NodeTaskService nodeTaskService; - // 各种资源管理 - private DataSourceService dataSourceService; // 连接池资源 - private DbDialectFactory dbDialectFactory; // 数据库信息资源 - private ArbitrateEventService arbitrateEventService; // 仲裁器资源 - private ExecutorService executorService; - - private StageAggregationCollector stageAggregationCollector; - - public void start() throws Throwable { - // 初始化节点 - initNid(); - nodeTaskService.addListener(this); // 将自己添加为NodeTask响应者 - } - - public void stop() throws Throwable { - for (Map tasks : controllers.values()) { - for (GlobalTask task : tasks.values()) { - try { - task.shutdown(); - } catch (Exception e) { - logger.error("##shutdown task error!", e); - } - } - } - - try { - Long nid = configClientService.currentNode().getId(); - arbitrateManageService.nodeEvent().destory(Long.valueOf(nid)); - } catch (Exception e) { - logger.error("##destory node error!", e); - } - - try { - arbitrateEventService.toolEvent().release(); - } catch (Exception e) { - logger.error("##destory arbitrate error!", e); - } - - try { - nodeTaskService.stopNode(); // 通知manager停止当前node - } catch (Exception e) { - logger.error("##stop node error!", e); - } - - try { - OtterContextLocator.close(); - } catch (Exception e) { - logger.error("##cloes spring error!", e); - } - - ZooKeeperClient.destory();// 关闭zookeeper - } - - public boolean process(List nodeTasks) { - if (nodeTasks == null || nodeTasks.isEmpty()) { - return true; - } - - for (NodeTask nodeTask : nodeTasks) { - boolean shutdown = nodeTask.isShutdown(); - Long pipelineId = nodeTask.getPipeline().getId(); - if (shutdown) { - Map tasks = controllers.remove(pipelineId); - if (tasks != null) { - logger.info("INFO ## shutdown this pipeline sync ,the pipelineId = {} and tasks = {}", pipelineId, - tasks.keySet()); - stopPipeline(pipelineId, tasks); - } else { - logger.info("INFO ## this pipeline id = {} is not start sync", pipelineId); - } - } else { - startPipeline(nodeTask); - } - } - - return true; - } - - // ===================== helper method ====================== - - public void startPipeline(NodeTask nodeTask) { - Long pipelineId = nodeTask.getPipeline().getId(); - releasePipeline(pipelineId); - Map tasks = controllers.get(pipelineId); - // 处理具体的任务命令 - List stage = nodeTask.getStage(); - List event = nodeTask.getEvent(); - for (int i = 0; i < stage.size(); i++) { - StageType stageType = stage.get(i); - TaskEvent taskEvent = event.get(i); - if (taskEvent.isCreate()) { - startTask(nodeTask.getPipeline(), tasks, stageType); - } else { - stopTask(tasks, stageType); - } - } - } - - private void startTask(Pipeline pipeline, Map tasks, StageType taskType) { - if (tasks.get(taskType) != null && tasks.get(taskType).isAlive()) { - logger.warn("WARN ## this task = {} has started", taskType); - } - - GlobalTask task = null; - if (taskType.isSelect()) { - task = new SelectTask(pipeline.getId()); - } else if (taskType.isExtract()) { - task = new ExtractTask(pipeline.getId()); - } else if (taskType.isTransform()) { - task = new TransformTask(pipeline.getId()); - } else if (taskType.isLoad()) { - task = new LoadTask(pipeline.getId()); - } - - if (task != null) { - OtterContextLocator.autowire(task); // 注入一下spring资源 - task.start(); - tasks.put(taskType, task); - logger.info("INFO ## start this task = {} success", taskType.toString()); - } - } - - private void stopTask(Map tasks, StageType taskType) { - GlobalTask task = tasks.remove(taskType); - if (task != null) { - task.shutdown(); - logger.info("INFO ## taskName = {} has shutdown", taskType); - } else { - logger.info("INFo ## taskName = {} is not started", taskType); - } - - } - - private void stopPipeline(Long pipelineId, Map tasks) { - for (GlobalTask task : tasks.values()) { - try { - task.shutdown(); - } catch (Exception e) { - logger.error("## stop s/e/t/l task error!", e); - } finally { - tasks.remove(task); - } - } - // close other resources. - try { - Thread.sleep(1 * 1000); // sleep 5s,等待S.E.T.L释放线程 - } catch (InterruptedException e) { - logger.error("ERROR ## ", e); - } - - // 释放资源 - releasePipeline(pipelineId); - arbitrateEventService.toolEvent().release(pipelineId); - } - - private void releasePipeline(Long pipelineId) { - dataSourceService.destroy(pipelineId); - dbDialectFactory.destory(pipelineId); - } - - private void initNid() { - // 获取一下nid变量 - String nid = System.getProperty(OtterConstants.NID_NAME); - if (StringUtils.isEmpty(nid)) { - throw new ConfigException("nid is not set!"); - } - logger.info("INFO ## the nodeId = {}", nid); - checkNidVaild(nid); - arbitrateManageService.nodeEvent().init(Long.valueOf(nid)); - // 添加session expired处理 - NodeSessionExpired sessionExpired = new NodeSessionExpired(); - sessionExpired.setNodeEvent(arbitrateManageService.nodeEvent()); - ZooKeeperClient.registerNotification(sessionExpired); - } - - // 判断本机ip是否和node.getIp()相同 - private void checkNidVaild(String nid) { - Node node = configClientService.currentNode(); - String hostIp = AddressUtils.getHostIp(); - String nodeIp = node.getIp(); - int nodePort = node.getPort().intValue(); - if (!AddressUtils.isHostIp(nodeIp)) { - throw new IllegalArgumentException( - String.format("node[%s] ip[%s] port[%s] , but your host ip[%s] is not matched!", - nid, nodeIp, nodePort, hostIp)); - } - } - - // ================ mbean info ======================= - - public String getHeapMemoryUsage() { - MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); - return JsonUtils.marshalToString(memoryUsage); - } - - public String getNodeSystemInfo() { - OperatingSystemMXBean mbean = ManagementFactory.getOperatingSystemMXBean(); - StringBuilder buf = new StringBuilder(); - buf.append("").append(mbean.getName()).append(' ').append(mbean.getVersion()).append(' ').append(mbean.getArch()); - buf.append(" @ ").append(mbean.getAvailableProcessors()).append(" cores"); - buf.append(" , 【 load average:").append(mbean.getSystemLoadAverage()).append(" 】"); - return buf.toString(); - } - - public String getNodeVersionInfo() { - return VersionInfo.getVersion() + " [ r" + VersionInfo.getRevision() + " ] @ " + VersionInfo.getDate(); - } - - public int getRunningPipelineCount() { - return controllers.size(); - } - - public List getRunningPipelines() { - return new ArrayList(controllers.keySet()); - } - - public int getThreadActiveSize() { - if (executorService instanceof ThreadPoolExecutor) { - ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; - return pool.getActiveCount(); - } - - return 0; - } - - public int getThreadPoolSize() { - if (executorService instanceof ThreadPoolExecutor) { - ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; - return pool.getCorePoolSize(); - } - - return 0; - } - - public void setThreadPoolSize(int size) { - if (executorService instanceof ThreadPoolExecutor) { - ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; - pool.setCorePoolSize(size); - pool.setMaximumPoolSize(size); - } - } - - public void setProfile(boolean profile) { - stageAggregationCollector.setProfiling(profile); - } - - public boolean isSelectRunning(Long pipelineId) { - return controllers.get(pipelineId).containsKey(StageType.SELECT); - } - - public boolean isExtractRunning(Long pipelineId) { - return controllers.get(pipelineId).containsKey(StageType.EXTRACT); - } - - public boolean isTransformRunning(Long pipelineId) { - return controllers.get(pipelineId).containsKey(StageType.TRANSFORM); - } - - public boolean isLoadRunning(Long pipelineId) { - return controllers.get(pipelineId).containsKey(StageType.LOAD); - } - - public String selectStageAggregation(Long pipelineId) { - return stageAggregationCollector.histogram(pipelineId, StageType.SELECT); - } - - public String extractStageAggregation(Long pipelineId) { - return stageAggregationCollector.histogram(pipelineId, StageType.EXTRACT); - } - - public String transformStageAggregation(Long pipelineId) { - return stageAggregationCollector.histogram(pipelineId, StageType.TRANSFORM); - } - - public String loadStageAggregation(Long pipelineId) { - return stageAggregationCollector.histogram(pipelineId, StageType.LOAD); - } - - public String selectPendingProcess(Long pipelineId) { - return pendingProcess(pipelineId, StageType.SELECT); - } - - public String extractPendingProcess(Long pipelineId) { - return pendingProcess(pipelineId, StageType.EXTRACT); - } - - public String transformPendingProcess(Long pipelineId) { - return pendingProcess(pipelineId, StageType.TRANSFORM); - } - - public String loadPendingProcess(Long pipelineId) { - return pendingProcess(pipelineId, StageType.LOAD); - } - - private String pendingProcess(Long pipelineId, StageType stage) { - GlobalTask task = controllers.get(pipelineId).get(stage); - if (task != null) { - return "stage:" + stage + " , pending:[" + StringUtils.join(task.getPendingProcess(), ',') + "]"; - } else { - return "node don't running stage:" + stage; - } - } - - // ==================== setter / getter ======================= - - public void setNodeTaskService(NodeTaskService nodeTaskService) { - this.nodeTaskService = nodeTaskService; - } - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - - public void setArbitrateManageService(ArbitrateManageService arbitrateManageService) { - this.arbitrateManageService = arbitrateManageService; - } - - public void setDataSourceService(DataSourceService dataSourceService) { - this.dataSourceService = dataSourceService; - } - - public void setDbDialectFactory(DbDialectFactory dbDialectFactory) { - this.dbDialectFactory = dbDialectFactory; - } - - public void setArbitrateEventService(ArbitrateEventService arbitrateEventService) { - this.arbitrateEventService = arbitrateEventService; - } - - public void setStageAggregationCollector(StageAggregationCollector stageAggregationCollector) { - this.stageAggregationCollector = stageAggregationCollector; - } - - public void setExecutorService(ExecutorService executorService) { - this.executorService = executorService; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl; + +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryUsage; +import java.lang.management.OperatingSystemMXBean; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.common.config.NodeTaskListener; +import com.alibaba.otter.node.common.config.NodeTaskService; +import com.alibaba.otter.node.common.config.model.NodeTask; +import com.alibaba.otter.node.common.config.model.NodeTask.TaskEvent; +import com.alibaba.otter.node.etl.common.datasource.DataSourceService; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; +import com.alibaba.otter.node.etl.common.jmx.StageAggregationCollector; +import com.alibaba.otter.node.etl.common.task.GlobalTask; +import com.alibaba.otter.node.etl.extract.ExtractTask; +import com.alibaba.otter.node.etl.load.LoadTask; +import com.alibaba.otter.node.etl.select.SelectTask; +import com.alibaba.otter.node.etl.transform.TransformTask; +import com.alibaba.otter.shared.arbitrate.ArbitrateEventService; +import com.alibaba.otter.shared.arbitrate.ArbitrateManageService; +import com.alibaba.otter.shared.arbitrate.impl.manage.NodeSessionExpired; +import com.alibaba.otter.shared.arbitrate.impl.zookeeper.ZooKeeperClient; +import com.alibaba.otter.shared.common.model.config.ConfigException; +import com.alibaba.otter.shared.common.model.config.enums.StageType; +import com.alibaba.otter.shared.common.model.config.node.Node; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; +import com.alibaba.otter.shared.common.utils.AddressUtils; +import com.alibaba.otter.shared.common.utils.JsonUtils; +import com.alibaba.otter.shared.common.utils.version.VersionInfo; +import com.google.common.base.Function; +import com.google.common.collect.MapMaker; + +/** + * 管理和维护对应node机器内的S.E.T.L任务,实时接收manager推送的NodeTask调度信息,可查看 {@linkplain NodeTaskService} + * + * @author jianghang 2012-4-21 下午04:48:12 + * @version 4.0.2 + */ +public class OtterController implements NodeTaskListener, OtterControllerMBean { + + private static final Logger logger = LoggerFactory.getLogger(OtterController.class); + + // 第一层为pipelineId,第二层为S.E.T.L模块 + private Map> controllers = new MapMaker().makeComputingMap(new Function>() { + + public Map apply(Long pipelineId) { + return new MapMaker().makeMap(); + } + }); + private ConfigClientService configClientService; + private ArbitrateManageService arbitrateManageService; + private NodeTaskService nodeTaskService; + // 各种资源管理 + private DataSourceService dataSourceService; // 连接池资源 + private DbDialectFactory dbDialectFactory; // 数据库信息资源 + private ArbitrateEventService arbitrateEventService; // 仲裁器资源 + private ExecutorService executorService; + + private StageAggregationCollector stageAggregationCollector; + + public void start() throws Throwable { + // 初始化节点 + initNid(); + nodeTaskService.addListener(this); // 将自己添加为NodeTask响应者 + } + + public void stop() throws Throwable { + for (Map tasks : controllers.values()) { + for (GlobalTask task : tasks.values()) { + try { + task.shutdown(); + } catch (Exception e) { + logger.error("##shutdown task error!", e); + } + } + } + + try { + Long nid = configClientService.currentNode().getId(); + arbitrateManageService.nodeEvent().destory(Long.valueOf(nid)); + } catch (Exception e) { + logger.error("##destory node error!", e); + } + + try { + arbitrateEventService.toolEvent().release(); + } catch (Exception e) { + logger.error("##destory arbitrate error!", e); + } + + try { + nodeTaskService.stopNode(); // 通知manager停止当前node + } catch (Exception e) { + logger.error("##stop node error!", e); + } + + try { + OtterContextLocator.close(); + } catch (Exception e) { + logger.error("##cloes spring error!", e); + } + + ZooKeeperClient.destory();// 关闭zookeeper + } + + public boolean process(List nodeTasks) { + if (nodeTasks == null || nodeTasks.isEmpty()) { + return true; + } + + for (NodeTask nodeTask : nodeTasks) { + boolean shutdown = nodeTask.isShutdown(); + Long pipelineId = nodeTask.getPipeline().getId(); + if (shutdown) { + Map tasks = controllers.remove(pipelineId); + if (tasks != null) { + logger.info("INFO ## shutdown this pipeline sync ,the pipelineId = {} and tasks = {}", pipelineId, + tasks.keySet()); + stopPipeline(pipelineId, tasks); + } else { + logger.info("INFO ## this pipeline id = {} is not start sync", pipelineId); + } + } else { + startPipeline(nodeTask); + } + } + + return true; + } + + // ===================== helper method ====================== + + public void startPipeline(NodeTask nodeTask) { + Long pipelineId = nodeTask.getPipeline().getId(); + releasePipeline(pipelineId); + Map tasks = controllers.get(pipelineId); + // 处理具体的任务命令 + List stage = nodeTask.getStage(); + List event = nodeTask.getEvent(); + for (int i = 0; i < stage.size(); i++) { + StageType stageType = stage.get(i); + TaskEvent taskEvent = event.get(i); + if (taskEvent.isCreate()) { + startTask(nodeTask.getPipeline(), tasks, stageType); + } else { + stopTask(tasks, stageType); + } + } + } + + private void startTask(Pipeline pipeline, Map tasks, StageType taskType) { + if (tasks.get(taskType) != null && tasks.get(taskType).isAlive()) { + logger.warn("WARN ## this task = {} has started", taskType); + } + + GlobalTask task = null; + if (taskType.isSelect()) { + task = new SelectTask(pipeline.getId()); + } else if (taskType.isExtract()) { + task = new ExtractTask(pipeline.getId()); + } else if (taskType.isTransform()) { + task = new TransformTask(pipeline.getId()); + } else if (taskType.isLoad()) { + task = new LoadTask(pipeline.getId()); + } + + if (task != null) { + OtterContextLocator.autowire(task); // 注入一下spring资源 + task.start(); + tasks.put(taskType, task); + logger.info("INFO ## start this task = {} success", taskType.toString()); + } + } + + private void stopTask(Map tasks, StageType taskType) { + GlobalTask task = tasks.remove(taskType); + if (task != null) { + task.shutdown(); + logger.info("INFO ## taskName = {} has shutdown", taskType); + } else { + logger.info("INFo ## taskName = {} is not started", taskType); + } + + } + + private void stopPipeline(Long pipelineId, Map tasks) { + for (GlobalTask task : tasks.values()) { + try { + task.shutdown(); + } catch (Exception e) { + logger.error("## stop s/e/t/l task error!", e); + } finally { + tasks.remove(task); + } + } + // close other resources. + try { + Thread.sleep(1 * 1000); // sleep 5s,等待S.E.T.L释放线程 + } catch (InterruptedException e) { + logger.error("ERROR ## ", e); + } + + // 释放资源 + releasePipeline(pipelineId); + arbitrateEventService.toolEvent().release(pipelineId); + } + + private void releasePipeline(Long pipelineId) { + dataSourceService.destroy(pipelineId); + dbDialectFactory.destory(pipelineId); + } + + private void initNid() { + // 获取一下nid变量 + String nid = System.getProperty(OtterConstants.NID_NAME); + if (StringUtils.isEmpty(nid)) { + throw new ConfigException("nid is not set!"); + } + logger.info("INFO ## the nodeId = {}", nid); + checkNidVaild(nid); + arbitrateManageService.nodeEvent().init(Long.valueOf(nid)); + // 添加session expired处理 + NodeSessionExpired sessionExpired = new NodeSessionExpired(); + sessionExpired.setNodeEvent(arbitrateManageService.nodeEvent()); + ZooKeeperClient.registerNotification(sessionExpired); + } + + // 判断本机ip是否和node.getIp()相同 + private void checkNidVaild(String nid) { + Node node = configClientService.currentNode(); + String hostIp = AddressUtils.getHostIp(); + String nodeIp = node.getIp(); + int nodePort = node.getPort().intValue(); + if (!AddressUtils.isHostIp(nodeIp)) { + throw new IllegalArgumentException( + String.format("node[%s] ip[%s] port[%s] , but your host ip[%s] is not matched!", + nid, nodeIp, nodePort, hostIp)); + } + } + + // ================ mbean info ======================= + + public String getHeapMemoryUsage() { + MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage(); + return JsonUtils.marshalToString(memoryUsage); + } + + public String getNodeSystemInfo() { + OperatingSystemMXBean mbean = ManagementFactory.getOperatingSystemMXBean(); + StringBuilder buf = new StringBuilder(); + buf.append("").append(mbean.getName()).append(' ').append(mbean.getVersion()).append(' ').append(mbean.getArch()); + buf.append(" @ ").append(mbean.getAvailableProcessors()).append(" cores"); + buf.append(" , 【 load average:").append(mbean.getSystemLoadAverage()).append(" 】"); + return buf.toString(); + } + + public String getNodeVersionInfo() { + return VersionInfo.getVersion() + " [ r" + VersionInfo.getRevision() + " ] @ " + VersionInfo.getDate(); + } + + public int getRunningPipelineCount() { + return controllers.size(); + } + + public List getRunningPipelines() { + return new ArrayList(controllers.keySet()); + } + + public int getThreadActiveSize() { + if (executorService instanceof ThreadPoolExecutor) { + ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; + return pool.getActiveCount(); + } + + return 0; + } + + public int getThreadPoolSize() { + if (executorService instanceof ThreadPoolExecutor) { + ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; + return pool.getCorePoolSize(); + } + + return 0; + } + + public void setThreadPoolSize(int size) { + if (executorService instanceof ThreadPoolExecutor) { + ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService; + pool.setCorePoolSize(size); + pool.setMaximumPoolSize(size); + } + } + + public void setProfile(boolean profile) { + stageAggregationCollector.setProfiling(profile); + } + + public boolean isSelectRunning(Long pipelineId) { + return controllers.get(pipelineId).containsKey(StageType.SELECT); + } + + public boolean isExtractRunning(Long pipelineId) { + return controllers.get(pipelineId).containsKey(StageType.EXTRACT); + } + + public boolean isTransformRunning(Long pipelineId) { + return controllers.get(pipelineId).containsKey(StageType.TRANSFORM); + } + + public boolean isLoadRunning(Long pipelineId) { + return controllers.get(pipelineId).containsKey(StageType.LOAD); + } + + public String selectStageAggregation(Long pipelineId) { + return stageAggregationCollector.histogram(pipelineId, StageType.SELECT); + } + + public String extractStageAggregation(Long pipelineId) { + return stageAggregationCollector.histogram(pipelineId, StageType.EXTRACT); + } + + public String transformStageAggregation(Long pipelineId) { + return stageAggregationCollector.histogram(pipelineId, StageType.TRANSFORM); + } + + public String loadStageAggregation(Long pipelineId) { + return stageAggregationCollector.histogram(pipelineId, StageType.LOAD); + } + + public String selectPendingProcess(Long pipelineId) { + return pendingProcess(pipelineId, StageType.SELECT); + } + + public String extractPendingProcess(Long pipelineId) { + return pendingProcess(pipelineId, StageType.EXTRACT); + } + + public String transformPendingProcess(Long pipelineId) { + return pendingProcess(pipelineId, StageType.TRANSFORM); + } + + public String loadPendingProcess(Long pipelineId) { + return pendingProcess(pipelineId, StageType.LOAD); + } + + private String pendingProcess(Long pipelineId, StageType stage) { + GlobalTask task = controllers.get(pipelineId).get(stage); + if (task != null) { + return "stage:" + stage + " , pending:[" + StringUtils.join(task.getPendingProcess(), ',') + "]"; + } else { + return "node don't running stage:" + stage; + } + } + + // ==================== setter / getter ======================= + + public void setNodeTaskService(NodeTaskService nodeTaskService) { + this.nodeTaskService = nodeTaskService; + } + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + + public void setArbitrateManageService(ArbitrateManageService arbitrateManageService) { + this.arbitrateManageService = arbitrateManageService; + } + + public void setDataSourceService(DataSourceService dataSourceService) { + this.dataSourceService = dataSourceService; + } + + public void setDbDialectFactory(DbDialectFactory dbDialectFactory) { + this.dbDialectFactory = dbDialectFactory; + } + + public void setArbitrateEventService(ArbitrateEventService arbitrateEventService) { + this.arbitrateEventService = arbitrateEventService; + } + + public void setStageAggregationCollector(StageAggregationCollector stageAggregationCollector) { + this.stageAggregationCollector = stageAggregationCollector; + } + + public void setExecutorService(ExecutorService executorService) { + this.executorService = executorService; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterControllerMBean.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterControllerMBean.java index 56158b27..00b6cf7c 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterControllerMBean.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/OtterControllerMBean.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/DataSourceService.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/DataSourceService.java index efcb6f20..3646a1e0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/DataSourceService.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/DataSourceService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.datasource; import com.alibaba.otter.shared.common.model.config.data.DataMediaSource; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/impl/DBDataSourceService.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/impl/DBDataSourceService.java index ca9809b4..0a08a2f5 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/impl/DBDataSourceService.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/datasource/impl/DBDataSourceService.java @@ -1,269 +1,283 @@ -package com.alibaba.otter.node.etl.common.datasource.impl; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.util.Assert; -import org.springframework.util.CollectionUtils; - -import com.alibaba.otter.common.push.datasource.DataSourceHanlder; -import com.alibaba.otter.node.etl.common.datasource.DataSourceService; -import com.alibaba.otter.shared.common.model.config.data.DataMediaSource; -import com.alibaba.otter.shared.common.model.config.data.DataMediaType; -import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; -import com.google.common.base.Function; -import com.google.common.collect.GenericMapMaker; -import com.google.common.collect.MapEvictionListener; -import com.google.common.collect.MapMaker; - -/** - * Comment of DataSourceServiceImpl - * - * @author xiaoqing.zhouxq - * @author zebinxu, add {@link DataSourceHanlder} - */ -public class DBDataSourceService implements DataSourceService, DisposableBean { - - private static final Logger logger = LoggerFactory.getLogger(DBDataSourceService.class); - - private List dataSourceHandlers; - - private int maxWait = 60 * 1000; - - private int minIdle = 0; - - private int initialSize = 0; - - private int maxActive = 32; - - private int maxIdle = 32; - - private int numTestsPerEvictionRun = -1; - - private int timeBetweenEvictionRunsMillis = 60 * 1000; - - private int removeAbandonedTimeout = 5 * 60; - - private int minEvictableIdleTimeMillis = 5 * 60 * 1000; - - /** - * 一个pipeline下面有一组DataSource.
- * key = pipelineId
- * value = key(dataMediaSourceId)-value(DataSource)
- */ - private Map> dataSources; - - public DBDataSourceService(){ - // 设置soft策略 - GenericMapMaker mapMaker = new MapMaker().softValues(); - mapMaker = ((MapMaker) mapMaker).evictionListener(new MapEvictionListener>() { - - public void onEviction(Long pipelineId, Map dataSources) { - if (dataSources == null) { - return; - } - - for (DataSource dataSource : dataSources.values()) { - // for filter to destroy custom datasource - if (letHandlerDestroyIfSupport(pipelineId, dataSource)) { - continue; - } - BasicDataSource basicDataSource = (BasicDataSource) dataSource; - try { - basicDataSource.close(); - } catch (SQLException e) { - logger.error("ERROR ## close the datasource has an error", e); - } - } - } - }); - - // 构建第一层map - dataSources = new MapMaker().makeComputingMap(new Function>() { - - public Map apply(final Long pipelineId) { - // 构建第二层map - return new MapMaker().makeComputingMap(new Function() { - - public DataSource apply(DbMediaSource dbMediaSource) { - - // 扩展功能,可以自定义一些自己实现的 dataSource - DataSource customDataSource = preCreate(pipelineId, dbMediaSource); - if (customDataSource != null) { - return customDataSource; - } - - return createDataSource(dbMediaSource.getUrl(), dbMediaSource.getUsername(), - dbMediaSource.getPassword(), dbMediaSource.getDriver(), - dbMediaSource.getType(), dbMediaSource.getEncode()); - } - - }); - } - }); - - } - - public DataSource getDataSource(long pipelineId, DataMediaSource dataMediaSource) { - Assert.notNull(dataMediaSource); - return dataSources.get(pipelineId).get(dataMediaSource); - } - - public void destroy(Long pipelineId) { - Map sources = dataSources.remove(pipelineId); - if (sources != null) { - for (DataSource source : sources.values()) { - try { - // for filter to destroy custom datasource - if (letHandlerDestroyIfSupport(pipelineId, source)) { - continue; - } - - // fallback for regular destroy - // TODO need to integrate to handler - BasicDataSource basicDataSource = (BasicDataSource) source; - basicDataSource.close(); - } catch (SQLException e) { - logger.error("ERROR ## close the datasource has an error", e); - } - } - - sources.clear(); - } - } - - private boolean letHandlerDestroyIfSupport(Long pipelineId, DataSource dataSource) { - boolean destroied = false; - - if (CollectionUtils.isEmpty(this.dataSourceHandlers)) { - return destroied; - } - for (DataSourceHanlder handler : this.dataSourceHandlers) { - if (handler.support(dataSource)) { - handler.destory(pipelineId); - destroied = true; - return destroied; - } - } - return destroied; - - } - - public void destroy() throws Exception { - for (Long pipelineId : dataSources.keySet()) { - destroy(pipelineId); - } - } - - private DataSource createDataSource(String url, String userName, String password, String driverClassName, - DataMediaType dataMediaType, String encoding) { - BasicDataSource dbcpDs = new BasicDataSource(); - - dbcpDs.setInitialSize(initialSize);// 初始化连接池时创建的连接数 - dbcpDs.setMaxActive(maxActive);// 连接池允许的最大并发连接数,值为非正数时表示不限制 - dbcpDs.setMaxIdle(maxIdle);// 连接池中的最大空闲连接数,超过时,多余的空闲连接将会被释放,值为负数时表示不限制 - dbcpDs.setMinIdle(minIdle);// 连接池中的最小空闲连接数,低于此数值时将会创建所欠缺的连接,值为0时表示不创建 - dbcpDs.setMaxWait(maxWait);// 以毫秒表示的当连接池中没有可用连接时等待可用连接返回的时间,超时则抛出异常,值为-1时表示无限等待 - dbcpDs.setRemoveAbandoned(true);// 是否清除已经超过removeAbandonedTimeout设置的无效连接 - dbcpDs.setLogAbandoned(true);// 当清除无效链接时是否在日志中记录清除信息的标志 - dbcpDs.setRemoveAbandonedTimeout(removeAbandonedTimeout); // 以秒表示清除无效链接的时限 - dbcpDs.setNumTestsPerEvictionRun(numTestsPerEvictionRun);// 确保连接池中没有已破损的连接 - dbcpDs.setTestOnBorrow(false);// 指定连接被调用时是否经过校验 - dbcpDs.setTestOnReturn(false);// 指定连接返回到池中时是否经过校验 - dbcpDs.setTestWhileIdle(true);// 指定连接进入空闲状态时是否经过空闲对象驱逐进程的校验 - dbcpDs.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); // 以毫秒表示空闲对象驱逐进程由运行状态进入休眠状态的时长,值为非正数时表示不运行任何空闲对象驱逐进程 - dbcpDs.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); // 以毫秒表示连接被空闲对象驱逐进程驱逐前在池中保持空闲状态的最小时间 - - // 动态的参数 - dbcpDs.setDriverClassName(driverClassName); - dbcpDs.setUrl(url); - dbcpDs.setUsername(userName); - dbcpDs.setPassword(password); - - if (dataMediaType.isOracle()) { - dbcpDs.addConnectionProperty("restrictGetTables", "true"); - dbcpDs.setValidationQuery("select 1 from dual"); - } else if (dataMediaType.isMysql()) { - // open the batch mode for mysql since 5.1.8 - dbcpDs.addConnectionProperty("useServerPrepStmts", "false"); - dbcpDs.addConnectionProperty("rewriteBatchedStatements", "true"); - if (StringUtils.isNotEmpty(encoding)) { - dbcpDs.addConnectionProperty("characterEncoding", encoding); - } - dbcpDs.setValidationQuery("select 1"); - } else { - logger.error("ERROR ## Unknow database type"); - } - - return dbcpDs; - } - - /** - * 扩展功能,可以自定义一些自己实现的 dataSource - */ - private DataSource preCreate(Long pipelineId, DbMediaSource dbMediaSource) { - - if (CollectionUtils.isEmpty(dataSourceHandlers)) { - return null; - } - - DataSource dataSource = null; - for (DataSourceHanlder handler : dataSourceHandlers) { - if (handler.support(dbMediaSource)) { - dataSource = handler.create(pipelineId, dbMediaSource); - if (dataSource != null) { - return dataSource; - } - } - } - return null; - } - - public void setMaxWait(int maxWait) { - this.maxWait = maxWait; - } - - public void setMinIdle(int minIdle) { - this.minIdle = minIdle; - } - - public void setInitialSize(int initialSize) { - this.initialSize = initialSize; - } - - public void setMaxActive(int maxActive) { - this.maxActive = maxActive; - } - - public void setMaxIdle(int maxIdle) { - this.maxIdle = maxIdle; - } - - public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { - this.numTestsPerEvictionRun = numTestsPerEvictionRun; - } - - public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) { - this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; - } - - public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) { - this.removeAbandonedTimeout = removeAbandonedTimeout; - } - - public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) { - this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; - } - - public void setDataSourceHandlers(List dataSourceHandlers) { - this.dataSourceHandlers = dataSourceHandlers; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.datasource.impl; + +import java.sql.SQLException; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.util.Assert; +import org.springframework.util.CollectionUtils; + +import com.alibaba.otter.common.push.datasource.DataSourceHanlder; +import com.alibaba.otter.node.etl.common.datasource.DataSourceService; +import com.alibaba.otter.shared.common.model.config.data.DataMediaSource; +import com.alibaba.otter.shared.common.model.config.data.DataMediaType; +import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; +import com.google.common.base.Function; +import com.google.common.collect.GenericMapMaker; +import com.google.common.collect.MapEvictionListener; +import com.google.common.collect.MapMaker; + +/** + * Comment of DataSourceServiceImpl + * + * @author xiaoqing.zhouxq + * @author zebinxu, add {@link DataSourceHanlder} + */ +public class DBDataSourceService implements DataSourceService, DisposableBean { + + private static final Logger logger = LoggerFactory.getLogger(DBDataSourceService.class); + + private List dataSourceHandlers; + + private int maxWait = 60 * 1000; + + private int minIdle = 0; + + private int initialSize = 0; + + private int maxActive = 32; + + private int maxIdle = 32; + + private int numTestsPerEvictionRun = -1; + + private int timeBetweenEvictionRunsMillis = 60 * 1000; + + private int removeAbandonedTimeout = 5 * 60; + + private int minEvictableIdleTimeMillis = 5 * 60 * 1000; + + /** + * 一个pipeline下面有一组DataSource.
+ * key = pipelineId
+ * value = key(dataMediaSourceId)-value(DataSource)
+ */ + private Map> dataSources; + + public DBDataSourceService(){ + // 设置soft策略 + GenericMapMaker mapMaker = new MapMaker().softValues(); + mapMaker = ((MapMaker) mapMaker).evictionListener(new MapEvictionListener>() { + + public void onEviction(Long pipelineId, Map dataSources) { + if (dataSources == null) { + return; + } + + for (DataSource dataSource : dataSources.values()) { + // for filter to destroy custom datasource + if (letHandlerDestroyIfSupport(pipelineId, dataSource)) { + continue; + } + BasicDataSource basicDataSource = (BasicDataSource) dataSource; + try { + basicDataSource.close(); + } catch (SQLException e) { + logger.error("ERROR ## close the datasource has an error", e); + } + } + } + }); + + // 构建第一层map + dataSources = new MapMaker().makeComputingMap(new Function>() { + + public Map apply(final Long pipelineId) { + // 构建第二层map + return new MapMaker().makeComputingMap(new Function() { + + public DataSource apply(DbMediaSource dbMediaSource) { + + // 扩展功能,可以自定义一些自己实现的 dataSource + DataSource customDataSource = preCreate(pipelineId, dbMediaSource); + if (customDataSource != null) { + return customDataSource; + } + + return createDataSource(dbMediaSource.getUrl(), dbMediaSource.getUsername(), + dbMediaSource.getPassword(), dbMediaSource.getDriver(), + dbMediaSource.getType(), dbMediaSource.getEncode()); + } + + }); + } + }); + + } + + public DataSource getDataSource(long pipelineId, DataMediaSource dataMediaSource) { + Assert.notNull(dataMediaSource); + return dataSources.get(pipelineId).get(dataMediaSource); + } + + public void destroy(Long pipelineId) { + Map sources = dataSources.remove(pipelineId); + if (sources != null) { + for (DataSource source : sources.values()) { + try { + // for filter to destroy custom datasource + if (letHandlerDestroyIfSupport(pipelineId, source)) { + continue; + } + + // fallback for regular destroy + // TODO need to integrate to handler + BasicDataSource basicDataSource = (BasicDataSource) source; + basicDataSource.close(); + } catch (SQLException e) { + logger.error("ERROR ## close the datasource has an error", e); + } + } + + sources.clear(); + } + } + + private boolean letHandlerDestroyIfSupport(Long pipelineId, DataSource dataSource) { + boolean destroied = false; + + if (CollectionUtils.isEmpty(this.dataSourceHandlers)) { + return destroied; + } + for (DataSourceHanlder handler : this.dataSourceHandlers) { + if (handler.support(dataSource)) { + handler.destory(pipelineId); + destroied = true; + return destroied; + } + } + return destroied; + + } + + public void destroy() throws Exception { + for (Long pipelineId : dataSources.keySet()) { + destroy(pipelineId); + } + } + + private DataSource createDataSource(String url, String userName, String password, String driverClassName, + DataMediaType dataMediaType, String encoding) { + BasicDataSource dbcpDs = new BasicDataSource(); + + dbcpDs.setInitialSize(initialSize);// 初始化连接池时创建的连接数 + dbcpDs.setMaxActive(maxActive);// 连接池允许的最大并发连接数,值为非正数时表示不限制 + dbcpDs.setMaxIdle(maxIdle);// 连接池中的最大空闲连接数,超过时,多余的空闲连接将会被释放,值为负数时表示不限制 + dbcpDs.setMinIdle(minIdle);// 连接池中的最小空闲连接数,低于此数值时将会创建所欠缺的连接,值为0时表示不创建 + dbcpDs.setMaxWait(maxWait);// 以毫秒表示的当连接池中没有可用连接时等待可用连接返回的时间,超时则抛出异常,值为-1时表示无限等待 + dbcpDs.setRemoveAbandoned(true);// 是否清除已经超过removeAbandonedTimeout设置的无效连接 + dbcpDs.setLogAbandoned(true);// 当清除无效链接时是否在日志中记录清除信息的标志 + dbcpDs.setRemoveAbandonedTimeout(removeAbandonedTimeout); // 以秒表示清除无效链接的时限 + dbcpDs.setNumTestsPerEvictionRun(numTestsPerEvictionRun);// 确保连接池中没有已破损的连接 + dbcpDs.setTestOnBorrow(false);// 指定连接被调用时是否经过校验 + dbcpDs.setTestOnReturn(false);// 指定连接返回到池中时是否经过校验 + dbcpDs.setTestWhileIdle(true);// 指定连接进入空闲状态时是否经过空闲对象驱逐进程的校验 + dbcpDs.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); // 以毫秒表示空闲对象驱逐进程由运行状态进入休眠状态的时长,值为非正数时表示不运行任何空闲对象驱逐进程 + dbcpDs.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); // 以毫秒表示连接被空闲对象驱逐进程驱逐前在池中保持空闲状态的最小时间 + + // 动态的参数 + dbcpDs.setDriverClassName(driverClassName); + dbcpDs.setUrl(url); + dbcpDs.setUsername(userName); + dbcpDs.setPassword(password); + + if (dataMediaType.isOracle()) { + dbcpDs.addConnectionProperty("restrictGetTables", "true"); + dbcpDs.setValidationQuery("select 1 from dual"); + } else if (dataMediaType.isMysql()) { + // open the batch mode for mysql since 5.1.8 + dbcpDs.addConnectionProperty("useServerPrepStmts", "false"); + dbcpDs.addConnectionProperty("rewriteBatchedStatements", "true"); + if (StringUtils.isNotEmpty(encoding)) { + dbcpDs.addConnectionProperty("characterEncoding", encoding); + } + dbcpDs.setValidationQuery("select 1"); + } else { + logger.error("ERROR ## Unknow database type"); + } + + return dbcpDs; + } + + /** + * 扩展功能,可以自定义一些自己实现的 dataSource + */ + private DataSource preCreate(Long pipelineId, DbMediaSource dbMediaSource) { + + if (CollectionUtils.isEmpty(dataSourceHandlers)) { + return null; + } + + DataSource dataSource = null; + for (DataSourceHanlder handler : dataSourceHandlers) { + if (handler.support(dbMediaSource)) { + dataSource = handler.create(pipelineId, dbMediaSource); + if (dataSource != null) { + return dataSource; + } + } + } + return null; + } + + public void setMaxWait(int maxWait) { + this.maxWait = maxWait; + } + + public void setMinIdle(int minIdle) { + this.minIdle = minIdle; + } + + public void setInitialSize(int initialSize) { + this.initialSize = initialSize; + } + + public void setMaxActive(int maxActive) { + this.maxActive = maxActive; + } + + public void setMaxIdle(int maxIdle) { + this.maxIdle = maxIdle; + } + + public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { + this.numTestsPerEvictionRun = numTestsPerEvictionRun; + } + + public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) { + this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; + } + + public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) { + this.removeAbandonedTimeout = removeAbandonedTimeout; + } + + public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) { + this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; + } + + public void setDataSourceHandlers(List dataSourceHandlers) { + this.dataSourceHandlers = dataSourceHandlers; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractDbDialect.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractDbDialect.java index e977847e..0414e2e6 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractDbDialect.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractDbDialect.java @@ -1,190 +1,204 @@ -package com.alibaba.otter.node.etl.common.db.dialect; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.exception.NestableRuntimeException; -import org.apache.ddlutils.model.Table; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ConnectionCallback; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import org.springframework.jdbc.support.lob.LobHandler; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.support.TransactionTemplate; -import org.springframework.util.Assert; - -import com.alibaba.otter.node.etl.common.datasource.DataSourceService; -import com.alibaba.otter.shared.common.utils.meta.DdlUtils; -import com.alibaba.otter.shared.common.utils.meta.DdlUtilsFilter; -import com.google.common.base.Function; -import com.google.common.collect.GenericMapMaker; -import com.google.common.collect.MapEvictionListener; -import com.google.common.collect.MapMaker; - -/** - * @author jianghang 2011-10-27 下午01:50:19 - * @version 4.0.0 - */ -public abstract class AbstractDbDialect implements DbDialect { - - protected static final Logger logger = LoggerFactory.getLogger(AbstractDbDialect.class); - protected int databaseMajorVersion; - protected int databaseMinorVersion; - protected String databaseName; - protected DataSourceService dataSourceService; - protected SqlTemplate sqlTemplate; - protected JdbcTemplate jdbcTemplate; - protected TransactionTemplate transactionTemplate; - protected LobHandler lobHandler; - protected Map, Table> tables; - - public AbstractDbDialect(final JdbcTemplate jdbcTemplate, LobHandler lobHandler){ - this.jdbcTemplate = jdbcTemplate; - this.lobHandler = lobHandler; - // 初始化transction - this.transactionTemplate = new TransactionTemplate(); - transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); - transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - - // 初始化一些数据 - jdbcTemplate.execute(new ConnectionCallback() { - - public Object doInConnection(Connection c) throws SQLException, DataAccessException { - DatabaseMetaData meta = c.getMetaData(); - databaseName = meta.getDatabaseProductName(); - databaseMajorVersion = meta.getDatabaseMajorVersion(); - databaseMinorVersion = meta.getDatabaseMinorVersion(); - - return null; - } - }); - - initTables(jdbcTemplate); - } - - public AbstractDbDialect(JdbcTemplate jdbcTemplate, LobHandler lobHandler, String name, int majorVersion, - int minorVersion){ - this.jdbcTemplate = jdbcTemplate; - this.lobHandler = lobHandler; - // 初始化transction - this.transactionTemplate = new TransactionTemplate(); - transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); - transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - - this.databaseName = name; - this.databaseMajorVersion = majorVersion; - this.databaseMinorVersion = minorVersion; - - initTables(jdbcTemplate); - } - - public Table findTable(String schema, String table, boolean useCache) { - List key = Arrays.asList(schema, table); - if (useCache == false) { - tables.remove(key); - } - - return tables.get(key); - } - - public Table findTable(String schema, String table) { - return findTable(schema, table, true); - } - - public void reloadTable(String schema, String table) { - if (StringUtils.isNotEmpty(table)) { - tables.remove(Arrays.asList(schema, table)); - } else { - // 如果没有存在表名,则直接清空所有的table,重新加载 - tables.clear(); - } - } - - public String getName() { - return databaseName; - } - - public int getMajorVersion() { - return databaseMajorVersion; - } - - @Override - public int getMinorVersion() { - return databaseMinorVersion; - } - - public String getVersion() { - return databaseMajorVersion + "." + databaseMinorVersion; - } - - public LobHandler getLobHandler() { - return lobHandler; - } - - public JdbcTemplate getJdbcTemplate() { - return jdbcTemplate; - } - - public TransactionTemplate getTransactionTemplate() { - return transactionTemplate; - } - - public SqlTemplate getSqlTemplate() { - return sqlTemplate; - } - - public void destory() { - } - - // ================================ helper method ========================== - - private void initTables(final JdbcTemplate jdbcTemplate) { - // soft引用设置,避免内存爆了 - GenericMapMaker mapMaker = null; - mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener, Table>() { - - public void onEviction(List names, Table table) { - logger.warn("Eviction For Table:" + table); - } - }); - - this.tables = mapMaker.makeComputingMap(new Function, Table>() { - - public Table apply(List names) { - Assert.isTrue(names.size() == 2); - try { - beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1)); - DdlUtilsFilter filter = getDdlUtilsFilter(jdbcTemplate, names.get(0), names.get(0), names.get(1)); - Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1), filter); - afterFindTable(table, jdbcTemplate, names.get(0), names.get(0), names.get(1)); - return table; - } catch (Exception e) { - throw new NestableRuntimeException("find table error : " + names.toString(), e); - } - } - }); - } - - protected DdlUtilsFilter getDdlUtilsFilter(JdbcTemplate jdbcTemplate, String catalogName, String schemaName, - String tableName) { - // we need to return null for backward compatibility - return null; - } - - protected void beforeFindTable(JdbcTemplate jdbcTemplate, String catalogName, String schemaName, String tableName) { - // for subclass to extend - } - - protected void afterFindTable(Table table, JdbcTemplate jdbcTemplate, String catalogName, String schemaName, - String tableName) { - // for subclass to extend - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db.dialect; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.exception.NestableRuntimeException; +import org.apache.ddlutils.model.Table; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ConnectionCallback; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.support.lob.LobHandler; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.util.Assert; + +import com.alibaba.otter.node.etl.common.datasource.DataSourceService; +import com.alibaba.otter.shared.common.utils.meta.DdlUtils; +import com.alibaba.otter.shared.common.utils.meta.DdlUtilsFilter; +import com.google.common.base.Function; +import com.google.common.collect.GenericMapMaker; +import com.google.common.collect.MapEvictionListener; +import com.google.common.collect.MapMaker; + +/** + * @author jianghang 2011-10-27 下午01:50:19 + * @version 4.0.0 + */ +public abstract class AbstractDbDialect implements DbDialect { + + protected static final Logger logger = LoggerFactory.getLogger(AbstractDbDialect.class); + protected int databaseMajorVersion; + protected int databaseMinorVersion; + protected String databaseName; + protected DataSourceService dataSourceService; + protected SqlTemplate sqlTemplate; + protected JdbcTemplate jdbcTemplate; + protected TransactionTemplate transactionTemplate; + protected LobHandler lobHandler; + protected Map, Table> tables; + + public AbstractDbDialect(final JdbcTemplate jdbcTemplate, LobHandler lobHandler){ + this.jdbcTemplate = jdbcTemplate; + this.lobHandler = lobHandler; + // 初始化transction + this.transactionTemplate = new TransactionTemplate(); + transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); + transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); + + // 初始化一些数据 + jdbcTemplate.execute(new ConnectionCallback() { + + public Object doInConnection(Connection c) throws SQLException, DataAccessException { + DatabaseMetaData meta = c.getMetaData(); + databaseName = meta.getDatabaseProductName(); + databaseMajorVersion = meta.getDatabaseMajorVersion(); + databaseMinorVersion = meta.getDatabaseMinorVersion(); + + return null; + } + }); + + initTables(jdbcTemplate); + } + + public AbstractDbDialect(JdbcTemplate jdbcTemplate, LobHandler lobHandler, String name, int majorVersion, + int minorVersion){ + this.jdbcTemplate = jdbcTemplate; + this.lobHandler = lobHandler; + // 初始化transction + this.transactionTemplate = new TransactionTemplate(); + transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); + transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); + + this.databaseName = name; + this.databaseMajorVersion = majorVersion; + this.databaseMinorVersion = minorVersion; + + initTables(jdbcTemplate); + } + + public Table findTable(String schema, String table, boolean useCache) { + List key = Arrays.asList(schema, table); + if (useCache == false) { + tables.remove(key); + } + + return tables.get(key); + } + + public Table findTable(String schema, String table) { + return findTable(schema, table, true); + } + + public void reloadTable(String schema, String table) { + if (StringUtils.isNotEmpty(table)) { + tables.remove(Arrays.asList(schema, table)); + } else { + // 如果没有存在表名,则直接清空所有的table,重新加载 + tables.clear(); + } + } + + public String getName() { + return databaseName; + } + + public int getMajorVersion() { + return databaseMajorVersion; + } + + @Override + public int getMinorVersion() { + return databaseMinorVersion; + } + + public String getVersion() { + return databaseMajorVersion + "." + databaseMinorVersion; + } + + public LobHandler getLobHandler() { + return lobHandler; + } + + public JdbcTemplate getJdbcTemplate() { + return jdbcTemplate; + } + + public TransactionTemplate getTransactionTemplate() { + return transactionTemplate; + } + + public SqlTemplate getSqlTemplate() { + return sqlTemplate; + } + + public void destory() { + } + + // ================================ helper method ========================== + + private void initTables(final JdbcTemplate jdbcTemplate) { + // soft引用设置,避免内存爆了 + GenericMapMaker mapMaker = null; + mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener, Table>() { + + public void onEviction(List names, Table table) { + logger.warn("Eviction For Table:" + table); + } + }); + + this.tables = mapMaker.makeComputingMap(new Function, Table>() { + + public Table apply(List names) { + Assert.isTrue(names.size() == 2); + try { + beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1)); + DdlUtilsFilter filter = getDdlUtilsFilter(jdbcTemplate, names.get(0), names.get(0), names.get(1)); + Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1), filter); + afterFindTable(table, jdbcTemplate, names.get(0), names.get(0), names.get(1)); + return table; + } catch (Exception e) { + throw new NestableRuntimeException("find table error : " + names.toString(), e); + } + } + }); + } + + protected DdlUtilsFilter getDdlUtilsFilter(JdbcTemplate jdbcTemplate, String catalogName, String schemaName, + String tableName) { + // we need to return null for backward compatibility + return null; + } + + protected void beforeFindTable(JdbcTemplate jdbcTemplate, String catalogName, String schemaName, String tableName) { + // for subclass to extend + } + + protected void afterFindTable(Table table, JdbcTemplate jdbcTemplate, String catalogName, String schemaName, + String tableName) { + // for subclass to extend + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java index ad2446b5..3c8034a9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/AbstractSqlTemplate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialect.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialect.java index 6ca9590a..56775ca3 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialect.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialect.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect; import org.apache.ddlutils.model.Table; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectFactory.java index 1b3adc1f..82312076 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectFactory.java @@ -1,126 +1,140 @@ -package com.alibaba.otter.node.etl.common.db.dialect; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.sql.DataSource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ConnectionCallback; -import org.springframework.jdbc.core.JdbcTemplate; - -import com.alibaba.otter.node.etl.common.datasource.DataSourceService; -import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; -import com.google.common.base.Function; -import com.google.common.collect.GenericMapMaker; -import com.google.common.collect.MapEvictionListener; -import com.google.common.collect.MapMaker; - -/** - * @author jianghang 2011-10-27 下午02:12:06 - * @version 4.0.0 - */ -public class DbDialectFactory implements DisposableBean { - - private static final Logger logger = LoggerFactory.getLogger(DbDialectFactory.class); - private DataSourceService dataSourceService; - private DbDialectGenerator dbDialectGenerator; - - // 第一层pipelineId , 第二层DbMediaSource id - private Map> dialects; - - public DbDialectFactory(){ - // 构建第一层map - GenericMapMaker mapMaker = null; - mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener>() { - - public void onEviction(Long pipelineId, - Map dialect) { - if (dialect == null) { - return; - } - - for (DbDialect dbDialect : dialect.values()) { - dbDialect.destory(); - } - } - }); - - dialects = mapMaker.makeComputingMap(new Function>() { - - public Map apply(final Long pipelineId) { - // 构建第二层map - return new MapMaker().makeComputingMap(new Function() { - - public DbDialect apply(final DbMediaSource source) { - DataSource dataSource = dataSourceService.getDataSource(pipelineId, source); - final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - return (DbDialect) jdbcTemplate.execute(new ConnectionCallback() { - - public Object doInConnection(Connection c) throws SQLException, DataAccessException { - DatabaseMetaData meta = c.getMetaData(); - String databaseName = meta.getDatabaseProductName(); - int databaseMajorVersion = meta.getDatabaseMajorVersion(); - int databaseMinorVersion = meta.getDatabaseMinorVersion(); - DbDialect dialect = dbDialectGenerator.generate(jdbcTemplate, databaseName, - databaseMajorVersion, - databaseMinorVersion, source.getType()); - if (dialect == null) { - throw new UnsupportedOperationException("no dialect for" + databaseName); - } - - if (logger.isInfoEnabled()) { - logger.info(String.format("--- DATABASE: %s, SCHEMA: %s ---", - databaseName, - (dialect.getDefaultSchema() == null) ? dialect.getDefaultCatalog() : dialect.getDefaultSchema())); - } - - return dialect; - } - }); - - } - }); - } - }); - - } - - public DbDialect getDbDialect(Long pipelineId, DbMediaSource source) { - return dialects.get(pipelineId).get(source); - } - - public void destory(Long pipelineId) { - Map dialect = dialects.remove(pipelineId); - if (dialect != null) { - for (DbDialect dbDialect : dialect.values()) { - dbDialect.destory(); - } - } - } - - public void destroy() throws Exception { - Set pipelineIds = new HashSet(dialects.keySet()); - for (Long pipelineId : pipelineIds) { - destory(pipelineId); - } - } - - // =============== setter / getter ================= - - public void setDataSourceService(DataSourceService dataSourceService) { - this.dataSourceService = dataSourceService; - } - - public void setDbDialectGenerator(DbDialectGenerator dbDialectGenerator) { - this.dbDialectGenerator = dbDialectGenerator; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db.dialect; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.SQLException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ConnectionCallback; +import org.springframework.jdbc.core.JdbcTemplate; + +import com.alibaba.otter.node.etl.common.datasource.DataSourceService; +import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; +import com.google.common.base.Function; +import com.google.common.collect.GenericMapMaker; +import com.google.common.collect.MapEvictionListener; +import com.google.common.collect.MapMaker; + +/** + * @author jianghang 2011-10-27 下午02:12:06 + * @version 4.0.0 + */ +public class DbDialectFactory implements DisposableBean { + + private static final Logger logger = LoggerFactory.getLogger(DbDialectFactory.class); + private DataSourceService dataSourceService; + private DbDialectGenerator dbDialectGenerator; + + // 第一层pipelineId , 第二层DbMediaSource id + private Map> dialects; + + public DbDialectFactory(){ + // 构建第一层map + GenericMapMaker mapMaker = null; + mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener>() { + + public void onEviction(Long pipelineId, + Map dialect) { + if (dialect == null) { + return; + } + + for (DbDialect dbDialect : dialect.values()) { + dbDialect.destory(); + } + } + }); + + dialects = mapMaker.makeComputingMap(new Function>() { + + public Map apply(final Long pipelineId) { + // 构建第二层map + return new MapMaker().makeComputingMap(new Function() { + + public DbDialect apply(final DbMediaSource source) { + DataSource dataSource = dataSourceService.getDataSource(pipelineId, source); + final JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); + return (DbDialect) jdbcTemplate.execute(new ConnectionCallback() { + + public Object doInConnection(Connection c) throws SQLException, DataAccessException { + DatabaseMetaData meta = c.getMetaData(); + String databaseName = meta.getDatabaseProductName(); + int databaseMajorVersion = meta.getDatabaseMajorVersion(); + int databaseMinorVersion = meta.getDatabaseMinorVersion(); + DbDialect dialect = dbDialectGenerator.generate(jdbcTemplate, databaseName, + databaseMajorVersion, + databaseMinorVersion, source.getType()); + if (dialect == null) { + throw new UnsupportedOperationException("no dialect for" + databaseName); + } + + if (logger.isInfoEnabled()) { + logger.info(String.format("--- DATABASE: %s, SCHEMA: %s ---", + databaseName, + (dialect.getDefaultSchema() == null) ? dialect.getDefaultCatalog() : dialect.getDefaultSchema())); + } + + return dialect; + } + }); + + } + }); + } + }); + + } + + public DbDialect getDbDialect(Long pipelineId, DbMediaSource source) { + return dialects.get(pipelineId).get(source); + } + + public void destory(Long pipelineId) { + Map dialect = dialects.remove(pipelineId); + if (dialect != null) { + for (DbDialect dbDialect : dialect.values()) { + dbDialect.destory(); + } + } + } + + public void destroy() throws Exception { + Set pipelineIds = new HashSet(dialects.keySet()); + for (Long pipelineId : pipelineIds) { + destory(pipelineId); + } + } + + // =============== setter / getter ================= + + public void setDataSourceService(DataSourceService dataSourceService) { + this.dataSourceService = dataSourceService; + } + + public void setDbDialectGenerator(DbDialectGenerator dbDialectGenerator) { + this.dbDialectGenerator = dbDialectGenerator; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectGenerator.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectGenerator.java index 6baef464..e04cd5d0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectGenerator.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/DbDialectGenerator.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect; import org.apache.commons.lang.StringUtils; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/SqlTemplate.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/SqlTemplate.java index c0faae10..4535d94d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/SqlTemplate.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/SqlTemplate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlDialect.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlDialect.java index 4d01cf36..7e68a067 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlDialect.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlDialect.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect.mysql; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlSqlTemplate.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlSqlTemplate.java index d2953395..933f80c7 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlSqlTemplate.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/mysql/MysqlSqlTemplate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect.mysql; import com.alibaba.otter.node.etl.common.db.dialect.AbstractSqlTemplate; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleDialect.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleDialect.java index 15c327de..a1218de0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleDialect.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleDialect.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect.oracle; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleSqlTemplate.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleSqlTemplate.java index 9f1e593e..002fb6bb 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleSqlTemplate.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/dialect/oracle/OracleSqlTemplate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.dialect.oracle; import com.alibaba.otter.node.etl.common.db.dialect.AbstractSqlTemplate; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/AutomaticJdbcExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/AutomaticJdbcExtractor.java index 058e4a1d..2246de12 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/AutomaticJdbcExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/AutomaticJdbcExtractor.java @@ -1,103 +1,117 @@ -package com.alibaba.otter.node.etl.common.db.lob; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; -import java.util.Map; - -import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor; - -/** - * copy from otter3.0,根据不同的数据源自动选择对应的NativeJdbcExtractor - * - * @author jianghang 2011-10-27 下午03:35:17 - * @version 4.0.0 - */ -public class AutomaticJdbcExtractor implements NativeJdbcExtractor { - - private NativeJdbcExtractor defaultJdbcExtractor; - private Map extractors; - private NativeJdbcExtractor jdbcExtractor; - - public AutomaticJdbcExtractor(){ - } - - public boolean isNativeConnectionNecessaryForNativeStatements() { - return true; - } - - public boolean isNativeConnectionNecessaryForNativePreparedStatements() { - return true; - } - - public boolean isNativeConnectionNecessaryForNativeCallableStatements() { - return true; - } - - public Connection getNativeConnection(Connection con) throws SQLException { - return getJdbcExtractor(con).getNativeConnection(con); - } - - private synchronized NativeJdbcExtractor getJdbcExtractor(Object o) { - if (jdbcExtractor == null) { - String objClass = o.getClass().getName(); - Iterator iterator = extractors.keySet().iterator(); - - while (iterator.hasNext()) { - String classPrefix = iterator.next(); - - if (objClass.indexOf(classPrefix) != -1) { - jdbcExtractor = (NativeJdbcExtractor) extractors.get(classPrefix); - - break; - } - } - - if (jdbcExtractor == null) { - jdbcExtractor = defaultJdbcExtractor; - } - } - - return jdbcExtractor; - } - - public Connection getNativeConnectionFromStatement(Statement stmt) throws SQLException { - return getJdbcExtractor(stmt).getNativeConnectionFromStatement(stmt); - } - - public Statement getNativeStatement(Statement stmt) throws SQLException { - return getJdbcExtractor(stmt).getNativeStatement(stmt); - } - - public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException { - return getJdbcExtractor(ps).getNativePreparedStatement(ps); - } - - public CallableStatement getNativeCallableStatement(CallableStatement cs) throws SQLException { - return getJdbcExtractor(cs).getNativeCallableStatement(cs); - } - - public ResultSet getNativeResultSet(ResultSet rs) throws SQLException { - return getJdbcExtractor(rs).getNativeResultSet(rs); - } - - public Map getExtractors() { - return extractors; - } - - public void setExtractors(Map extractors) { - this.extractors = extractors; - } - - public NativeJdbcExtractor getDefaultJdbcExtractor() { - return defaultJdbcExtractor; - } - - public void setDefaultJdbcExtractor(NativeJdbcExtractor defaultJdbcExtractor) { - this.defaultJdbcExtractor = defaultJdbcExtractor; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db.lob; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Iterator; +import java.util.Map; + +import org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor; + +/** + * copy from otter3.0,根据不同的数据源自动选择对应的NativeJdbcExtractor + * + * @author jianghang 2011-10-27 下午03:35:17 + * @version 4.0.0 + */ +public class AutomaticJdbcExtractor implements NativeJdbcExtractor { + + private NativeJdbcExtractor defaultJdbcExtractor; + private Map extractors; + private NativeJdbcExtractor jdbcExtractor; + + public AutomaticJdbcExtractor(){ + } + + public boolean isNativeConnectionNecessaryForNativeStatements() { + return true; + } + + public boolean isNativeConnectionNecessaryForNativePreparedStatements() { + return true; + } + + public boolean isNativeConnectionNecessaryForNativeCallableStatements() { + return true; + } + + public Connection getNativeConnection(Connection con) throws SQLException { + return getJdbcExtractor(con).getNativeConnection(con); + } + + private synchronized NativeJdbcExtractor getJdbcExtractor(Object o) { + if (jdbcExtractor == null) { + String objClass = o.getClass().getName(); + Iterator iterator = extractors.keySet().iterator(); + + while (iterator.hasNext()) { + String classPrefix = iterator.next(); + + if (objClass.indexOf(classPrefix) != -1) { + jdbcExtractor = (NativeJdbcExtractor) extractors.get(classPrefix); + + break; + } + } + + if (jdbcExtractor == null) { + jdbcExtractor = defaultJdbcExtractor; + } + } + + return jdbcExtractor; + } + + public Connection getNativeConnectionFromStatement(Statement stmt) throws SQLException { + return getJdbcExtractor(stmt).getNativeConnectionFromStatement(stmt); + } + + public Statement getNativeStatement(Statement stmt) throws SQLException { + return getJdbcExtractor(stmt).getNativeStatement(stmt); + } + + public PreparedStatement getNativePreparedStatement(PreparedStatement ps) throws SQLException { + return getJdbcExtractor(ps).getNativePreparedStatement(ps); + } + + public CallableStatement getNativeCallableStatement(CallableStatement cs) throws SQLException { + return getJdbcExtractor(cs).getNativeCallableStatement(cs); + } + + public ResultSet getNativeResultSet(ResultSet rs) throws SQLException { + return getJdbcExtractor(rs).getNativeResultSet(rs); + } + + public Map getExtractors() { + return extractors; + } + + public void setExtractors(Map extractors) { + this.extractors = extractors; + } + + public NativeJdbcExtractor getDefaultJdbcExtractor() { + return defaultJdbcExtractor; + } + + public void setDefaultJdbcExtractor(NativeJdbcExtractor defaultJdbcExtractor) { + this.defaultJdbcExtractor = defaultJdbcExtractor; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/LazyNativeJdbcExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/LazyNativeJdbcExtractor.java index a0729b71..620ded62 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/LazyNativeJdbcExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/lob/LazyNativeJdbcExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.lob; import java.sql.CallableStatement; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/ByteArrayConverter.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/ByteArrayConverter.java index 46bb52cd..a93695b3 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/ByteArrayConverter.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/ByteArrayConverter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db.utils; import org.apache.commons.beanutils.ConversionException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlTimestampConverter.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlTimestampConverter.java index 68c6fab3..580ed37f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlTimestampConverter.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlTimestampConverter.java @@ -1,138 +1,152 @@ -package com.alibaba.otter.node.etl.common.db.utils; - -import java.sql.Timestamp; -import java.text.ParseException; -import java.text.ParsePosition; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.beanutils.Converter; -import org.apache.commons.lang.time.DateFormatUtils; - -public class SqlTimestampConverter implements Converter { - - /** Field description */ - public static final String[] DATE_FORMATS = new String[] { "yyyy-MM-dd", "HH:mm:ss", "yyyy-MM-dd HH:mm:ss", - "yyyy-MM-dd hh:mm:ss.fffffffff", "EEE MMM dd HH:mm:ss zzz yyyy", - DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), - DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), - DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), }; - - public static final Converter SQL_TIMESTAMP = new SqlTimestampConverter(null); - - /** - * The default value specified to our Constructor, if any. - */ - private final Object defaultValue; - - /** - * Should we return the default value on conversion errors? - */ - private final boolean useDefault; - - /** - * Create a {@link Converter} that will throw a {@link ConversionException} if a conversion error occurs. - */ - public SqlTimestampConverter(){ - this.defaultValue = null; - this.useDefault = false; - } - - /** - * Create a {@link Converter} that will return the specified default value if a conversion error occurs. - * - * @param defaultValue The default value to be returned - */ - public SqlTimestampConverter(Object defaultValue){ - this.defaultValue = defaultValue; - this.useDefault = true; - } - - /** - * Convert the specified input object into an output object of the specified type. - * - * @param type Data type to which this value should be converted - * @param value The input value to be converted - * @exception ConversionException if conversion cannot be performed successfully - */ - public Object convert(Class type, Object value) { - if (value == null) { - if (useDefault) { - return (defaultValue); - } else { - throw new ConversionException("No value specified"); - } - } - - if (value instanceof java.sql.Date && java.sql.Date.class.equals(type)) { - return value; - } else if (value instanceof java.sql.Time && java.sql.Time.class.equals(type)) { - return value; - } else if (value instanceof java.sql.Timestamp && java.sql.Timestamp.class.equals(type)) { - return value; - } else { - try { - if (java.sql.Date.class.equals(type)) { - return new java.sql.Date(convertTimestamp2TimeMillis(value.toString())); - } else if (java.sql.Time.class.equals(type)) { - return new java.sql.Time(convertTimestamp2TimeMillis(value.toString())); - } else if (java.sql.Timestamp.class.equals(type)) { - return new java.sql.Timestamp(convertTimestamp2TimeMillis(value.toString())); - } else { - return new Timestamp(convertTimestamp2TimeMillis(value.toString())); - } - } catch (Exception e) { - throw new ConversionException("Value format invalid: " + e.getMessage(), e); - } - } - - } - - private Long convertTimestamp2TimeMillis(String input) { - if (input == null) { - return null; - } - - try { - // 先处理Timestamp类型 - return java.sql.Timestamp.valueOf(input).getTime(); - } catch (Exception nfe) { - try { - try { - return parseDate(input, DATE_FORMATS, Locale.ENGLISH).getTime(); - } catch (Exception err) { - return parseDate(input, DATE_FORMATS, Locale.getDefault()).getTime(); - } - } catch (Exception err) { - // 最后处理long time的情况 - return Long.parseLong(input); - } - } - } - - private Date parseDate(String str, String[] parsePatterns, Locale locale) throws ParseException { - if ((str == null) || (parsePatterns == null)) { - throw new IllegalArgumentException("Date and Patterns must not be null"); - } - - SimpleDateFormat parser = null; - ParsePosition pos = new ParsePosition(0); - - for (int i = 0; i < parsePatterns.length; i++) { - if (i == 0) { - parser = new SimpleDateFormat(parsePatterns[0], locale); - } else { - parser.applyPattern(parsePatterns[i]); - } - pos.setIndex(0); - Date date = parser.parse(str, pos); - if ((date != null) && (pos.getIndex() == str.length())) { - return date; - } - } - - throw new ParseException("Unable to parse the date: " + str, -1); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db.utils; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +import org.apache.commons.beanutils.ConversionException; +import org.apache.commons.beanutils.Converter; +import org.apache.commons.lang.time.DateFormatUtils; + +public class SqlTimestampConverter implements Converter { + + /** Field description */ + public static final String[] DATE_FORMATS = new String[] { "yyyy-MM-dd", "HH:mm:ss", "yyyy-MM-dd HH:mm:ss", + "yyyy-MM-dd hh:mm:ss.fffffffff", "EEE MMM dd HH:mm:ss zzz yyyy", + DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(), + DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), }; + + public static final Converter SQL_TIMESTAMP = new SqlTimestampConverter(null); + + /** + * The default value specified to our Constructor, if any. + */ + private final Object defaultValue; + + /** + * Should we return the default value on conversion errors? + */ + private final boolean useDefault; + + /** + * Create a {@link Converter} that will throw a {@link ConversionException} if a conversion error occurs. + */ + public SqlTimestampConverter(){ + this.defaultValue = null; + this.useDefault = false; + } + + /** + * Create a {@link Converter} that will return the specified default value if a conversion error occurs. + * + * @param defaultValue The default value to be returned + */ + public SqlTimestampConverter(Object defaultValue){ + this.defaultValue = defaultValue; + this.useDefault = true; + } + + /** + * Convert the specified input object into an output object of the specified type. + * + * @param type Data type to which this value should be converted + * @param value The input value to be converted + * @exception ConversionException if conversion cannot be performed successfully + */ + public Object convert(Class type, Object value) { + if (value == null) { + if (useDefault) { + return (defaultValue); + } else { + throw new ConversionException("No value specified"); + } + } + + if (value instanceof java.sql.Date && java.sql.Date.class.equals(type)) { + return value; + } else if (value instanceof java.sql.Time && java.sql.Time.class.equals(type)) { + return value; + } else if (value instanceof java.sql.Timestamp && java.sql.Timestamp.class.equals(type)) { + return value; + } else { + try { + if (java.sql.Date.class.equals(type)) { + return new java.sql.Date(convertTimestamp2TimeMillis(value.toString())); + } else if (java.sql.Time.class.equals(type)) { + return new java.sql.Time(convertTimestamp2TimeMillis(value.toString())); + } else if (java.sql.Timestamp.class.equals(type)) { + return new java.sql.Timestamp(convertTimestamp2TimeMillis(value.toString())); + } else { + return new Timestamp(convertTimestamp2TimeMillis(value.toString())); + } + } catch (Exception e) { + throw new ConversionException("Value format invalid: " + e.getMessage(), e); + } + } + + } + + private Long convertTimestamp2TimeMillis(String input) { + if (input == null) { + return null; + } + + try { + // 先处理Timestamp类型 + return java.sql.Timestamp.valueOf(input).getTime(); + } catch (Exception nfe) { + try { + try { + return parseDate(input, DATE_FORMATS, Locale.ENGLISH).getTime(); + } catch (Exception err) { + return parseDate(input, DATE_FORMATS, Locale.getDefault()).getTime(); + } + } catch (Exception err) { + // 最后处理long time的情况 + return Long.parseLong(input); + } + } + } + + private Date parseDate(String str, String[] parsePatterns, Locale locale) throws ParseException { + if ((str == null) || (parsePatterns == null)) { + throw new IllegalArgumentException("Date and Patterns must not be null"); + } + + SimpleDateFormat parser = null; + ParsePosition pos = new ParsePosition(0); + + for (int i = 0; i < parsePatterns.length; i++) { + if (i == 0) { + parser = new SimpleDateFormat(parsePatterns[0], locale); + } else { + parser.applyPattern(parsePatterns[i]); + } + pos.setIndex(0); + Date date = parser.parse(str, pos); + if ((date != null) && (pos.getIndex() == str.length())) { + return date; + } + } + + throw new ParseException("Unable to parse the date: " + str, -1); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java index c0aadc8e..07b2793d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/db/utils/SqlUtils.java @@ -1,289 +1,303 @@ -package com.alibaba.otter.node.etl.common.db.utils; - -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.beanutils.ConvertUtilsBean; -import org.apache.commons.lang.ArrayUtils; -import org.apache.commons.lang.StringUtils; - -/** - * @author xiaoqing.zhouxq - */ -public class SqlUtils { - - public static final String REQUIRED_FIELD_NULL_SUBSTITUTE = " "; - public static final String SQLDATE_FORMAT = "yyyy-MM-dd"; - public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss"; - private static final Map> sqlTypeToJavaTypeMap = new HashMap>(); - private static final ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean(); - - static { - // regist Converter - convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Date.class); - convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Time.class); - convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Timestamp.class); - convertUtilsBean.register(ByteArrayConverter.SQL_BYTES, byte[].class); - - // bool - sqlTypeToJavaTypeMap.put(Types.BOOLEAN, Boolean.class); - - // int - sqlTypeToJavaTypeMap.put(Types.TINYINT, Integer.class); - sqlTypeToJavaTypeMap.put(Types.SMALLINT, Integer.class); - sqlTypeToJavaTypeMap.put(Types.BIT, Integer.class); - sqlTypeToJavaTypeMap.put(Types.INTEGER, Long.class); - - // long - sqlTypeToJavaTypeMap.put(Types.BIGINT, BigDecimal.class); - - // decimal - sqlTypeToJavaTypeMap.put(Types.REAL, Float.class); - sqlTypeToJavaTypeMap.put(Types.FLOAT, Float.class); - sqlTypeToJavaTypeMap.put(Types.DOUBLE, Double.class); - sqlTypeToJavaTypeMap.put(Types.NUMERIC, BigDecimal.class); - sqlTypeToJavaTypeMap.put(Types.DECIMAL, BigDecimal.class); - - // date - sqlTypeToJavaTypeMap.put(Types.DATE, java.sql.Date.class); - sqlTypeToJavaTypeMap.put(Types.TIME, java.sql.Time.class); - sqlTypeToJavaTypeMap.put(Types.TIMESTAMP, java.sql.Timestamp.class); - - // blob - sqlTypeToJavaTypeMap.put(Types.BLOB, byte[].class); - - // byte[] - sqlTypeToJavaTypeMap.put(Types.REF, byte[].class); - sqlTypeToJavaTypeMap.put(Types.OTHER, byte[].class); - sqlTypeToJavaTypeMap.put(Types.ARRAY, byte[].class); - sqlTypeToJavaTypeMap.put(Types.STRUCT, byte[].class); - sqlTypeToJavaTypeMap.put(Types.SQLXML, byte[].class); - sqlTypeToJavaTypeMap.put(Types.BINARY, byte[].class); - sqlTypeToJavaTypeMap.put(Types.DATALINK, byte[].class); - sqlTypeToJavaTypeMap.put(Types.DISTINCT, byte[].class); - sqlTypeToJavaTypeMap.put(Types.VARBINARY, byte[].class); - sqlTypeToJavaTypeMap.put(Types.JAVA_OBJECT, byte[].class); - sqlTypeToJavaTypeMap.put(Types.LONGVARBINARY, byte[].class); - - // String - sqlTypeToJavaTypeMap.put(Types.CHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.VARCHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.LONGVARCHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.LONGNVARCHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.NCHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.NVARCHAR, String.class); - sqlTypeToJavaTypeMap.put(Types.NCLOB, String.class); - sqlTypeToJavaTypeMap.put(Types.CLOB, String.class); - } - - /** - * 将指定java.sql.Types的ResultSet value转换成相应的String - * - * @param rs - * @param index - * @param sqlType - * @return - * @throws SQLException - */ - public static String sqlValueToString(ResultSet rs, int index, int sqlType) throws SQLException { - Class requiredType = sqlTypeToJavaTypeMap.get(sqlType); - if (requiredType == null) { - throw new IllegalArgumentException("unknow java.sql.Types - " + sqlType); - } - - return getResultSetValue(rs, index, requiredType); - } - - /** - * sqlValueToString方法的逆向过程 - * - * @param value - * @param sqlType - * @param isTextRequired - * @param isEmptyStringNulled - * @return - */ - public static Object stringToSqlValue(String value, int sqlType, boolean isRequired, boolean isEmptyStringNulled) { - // 设置变量 - String sourceValue = value; - if (SqlUtils.isTextType(sqlType)) { - if ((sourceValue == null) || ((true == StringUtils.isEmpty(sourceValue)) && isEmptyStringNulled)) { - return isRequired ? REQUIRED_FIELD_NULL_SUBSTITUTE : null; - } else { - return sourceValue; - } - } else { - if (StringUtils.isEmpty(sourceValue)) { - return null; - } else { - Class requiredType = sqlTypeToJavaTypeMap.get(sqlType); - if (requiredType == null) { - throw new IllegalArgumentException("unknow java.sql.Types - " + sqlType); - } else if (requiredType.equals(String.class)) { - return sourceValue; - } else if (true == isNumeric(sqlType)) { - return convertUtilsBean.convert(sourceValue.trim(), requiredType); - } else { - return convertUtilsBean.convert(sourceValue, requiredType); - } - } - } - } - - public static String encoding(String source, int sqlType, String sourceEncoding, String targetEncoding) { - switch (sqlType) { - case Types.CHAR: - case Types.VARCHAR: - case Types.LONGVARCHAR: - case Types.NCHAR: - case Types.NVARCHAR: - case Types.LONGNVARCHAR: - case Types.CLOB: - case Types.NCLOB: - if (false == StringUtils.isEmpty(source)) { - String fromEncoding = StringUtils.isBlank(sourceEncoding) ? "UTF-8" : sourceEncoding; - String toEncoding = StringUtils.isBlank(targetEncoding) ? "UTF-8" : targetEncoding; - - // if (false == StringUtils.equalsIgnoreCase(fromEncoding, toEncoding)) { - try { - return new String(source.getBytes(fromEncoding), toEncoding); - } catch (UnsupportedEncodingException e) { - throw new IllegalArgumentException(e.getMessage(), e); - } - // } - } - } - - return source; - } - - /** - * Retrieve a JDBC column value from a ResultSet, using the specified value type. - *

- * Uses the specifically typed ResultSet accessor methods, falling back to - * {@link #getResultSetValue(java.sql.ResultSet, int)} for unknown types. - *

- * Note that the returned value may not be assignable to the specified required type, in case of an unknown type. - * Calling code needs to deal with this case appropriately, e.g. throwing a corresponding exception. - * - * @param rs is the ResultSet holding the data - * @param index is the column index - * @param requiredType the required value type (may be null) - * @return the value object - * @throws SQLException if thrown by the JDBC API - */ - private static String getResultSetValue(ResultSet rs, int index, Class requiredType) throws SQLException { - if (requiredType == null) { - return getResultSetValue(rs, index); - } - - Object value = null; - boolean wasNullCheck = false; - - // Explicitly extract typed value, as far as possible. - if (String.class.equals(requiredType)) { - value = rs.getString(index); - } else if (boolean.class.equals(requiredType) || Boolean.class.equals(requiredType)) { - value = Boolean.valueOf(rs.getBoolean(index)); - wasNullCheck = true; - } else if (byte.class.equals(requiredType) || Byte.class.equals(requiredType)) { - value = new Byte(rs.getByte(index)); - wasNullCheck = true; - } else if (short.class.equals(requiredType) || Short.class.equals(requiredType)) { - value = new Short(rs.getShort(index)); - wasNullCheck = true; - } else if (int.class.equals(requiredType) || Integer.class.equals(requiredType)) { - value = new Long(rs.getLong(index)); - wasNullCheck = true; - } else if (long.class.equals(requiredType) || Long.class.equals(requiredType)) { - value = rs.getBigDecimal(index); - wasNullCheck = true; - } else if (float.class.equals(requiredType) || Float.class.equals(requiredType)) { - value = new Float(rs.getFloat(index)); - wasNullCheck = true; - } else if (double.class.equals(requiredType) || Double.class.equals(requiredType) - || Number.class.equals(requiredType)) { - value = new Double(rs.getDouble(index)); - wasNullCheck = true; - } else if (java.sql.Time.class.equals(requiredType)) { - value = rs.getTime(index); - } else if (java.sql.Timestamp.class.equals(requiredType) || java.sql.Date.class.equals(requiredType) - || java.sql.Time.class.equals(requiredType) || java.util.Date.class.equals(requiredType)) { - value = convertTimestamp(rs.getTimestamp(index)); - } else if (BigDecimal.class.equals(requiredType)) { - value = rs.getBigDecimal(index); - } else if (Blob.class.equals(requiredType)) { - value = rs.getBlob(index); - } else if (Clob.class.equals(requiredType)) { - value = rs.getClob(index); - } else if (byte[].class.equals(requiredType)) { - value = ArrayUtils.toString(rs.getBytes(index), ""); - } else { - - // Some unknown type desired -> rely on getObject. - value = getResultSetValue(rs, index); - } - - // Perform was-null check if demanded (for results that the - // JDBC driver returns as primitives). - if (wasNullCheck && (value != null) && rs.wasNull()) { - value = null; - } - - return (value == null) ? null : convertUtilsBean.convert(value); - } - - /** - * Retrieve a JDBC column value from a ResultSet, using the most appropriate value type. The returned value should - * be a detached value object, not having any ties to the active ResultSet: in particular, it should not be a Blob - * or Clob object but rather a byte array respectively String representation. - *

- * Uses the getObject(index) method, but includes additional "hacks" to get around Oracle 10g returning - * a non-standard object for its TIMESTAMP datatype and a java.sql.Date for DATE columns leaving out - * the time portion: These columns will explicitly be extracted as standard java.sql.Timestamp object. - * - * @param rs is the ResultSet holding the data - * @param index is the column index - * @return the value object - * @throws SQLException if thrown by the JDBC API - * @see java.sql.Blob - * @see java.sql.Clob - * @see java.sql.Timestamp - */ - private static String getResultSetValue(ResultSet rs, int index) throws SQLException { - Object obj = rs.getObject(index); - return (obj == null) ? null : convertUtilsBean.convert(obj); - } - - private static Object convertTimestamp(Timestamp timestamp) { - return (timestamp == null) ? null : timestamp.getTime(); - } - - /** - * Check whether the given SQL type is numeric. - */ - public static boolean isNumeric(int sqlType) { - return (Types.BIT == sqlType) || (Types.BIGINT == sqlType) || (Types.DECIMAL == sqlType) - || (Types.DOUBLE == sqlType) || (Types.FLOAT == sqlType) || (Types.INTEGER == sqlType) - || (Types.NUMERIC == sqlType) || (Types.REAL == sqlType) || (Types.SMALLINT == sqlType) - || (Types.TINYINT == sqlType); - } - - public static boolean isTextType(int sqlType) { - if (sqlType == Types.CHAR || sqlType == Types.VARCHAR || sqlType == Types.CLOB || sqlType == Types.LONGVARCHAR - || sqlType == Types.NCHAR || sqlType == Types.NVARCHAR || sqlType == Types.NCLOB - || sqlType == Types.LONGNVARCHAR) { - return true; - } else { - return false; - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db.utils; + +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.beanutils.ConvertUtilsBean; +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.lang.StringUtils; + +/** + * @author xiaoqing.zhouxq + */ +public class SqlUtils { + + public static final String REQUIRED_FIELD_NULL_SUBSTITUTE = " "; + public static final String SQLDATE_FORMAT = "yyyy-MM-dd"; + public static final String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss"; + private static final Map> sqlTypeToJavaTypeMap = new HashMap>(); + private static final ConvertUtilsBean convertUtilsBean = new ConvertUtilsBean(); + + static { + // regist Converter + convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Date.class); + convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Time.class); + convertUtilsBean.register(SqlTimestampConverter.SQL_TIMESTAMP, java.sql.Timestamp.class); + convertUtilsBean.register(ByteArrayConverter.SQL_BYTES, byte[].class); + + // bool + sqlTypeToJavaTypeMap.put(Types.BOOLEAN, Boolean.class); + + // int + sqlTypeToJavaTypeMap.put(Types.TINYINT, Integer.class); + sqlTypeToJavaTypeMap.put(Types.SMALLINT, Integer.class); + sqlTypeToJavaTypeMap.put(Types.BIT, Integer.class); + sqlTypeToJavaTypeMap.put(Types.INTEGER, Long.class); + + // long + sqlTypeToJavaTypeMap.put(Types.BIGINT, BigDecimal.class); + + // decimal + sqlTypeToJavaTypeMap.put(Types.REAL, Float.class); + sqlTypeToJavaTypeMap.put(Types.FLOAT, Float.class); + sqlTypeToJavaTypeMap.put(Types.DOUBLE, Double.class); + sqlTypeToJavaTypeMap.put(Types.NUMERIC, BigDecimal.class); + sqlTypeToJavaTypeMap.put(Types.DECIMAL, BigDecimal.class); + + // date + sqlTypeToJavaTypeMap.put(Types.DATE, java.sql.Date.class); + sqlTypeToJavaTypeMap.put(Types.TIME, java.sql.Time.class); + sqlTypeToJavaTypeMap.put(Types.TIMESTAMP, java.sql.Timestamp.class); + + // blob + sqlTypeToJavaTypeMap.put(Types.BLOB, byte[].class); + + // byte[] + sqlTypeToJavaTypeMap.put(Types.REF, byte[].class); + sqlTypeToJavaTypeMap.put(Types.OTHER, byte[].class); + sqlTypeToJavaTypeMap.put(Types.ARRAY, byte[].class); + sqlTypeToJavaTypeMap.put(Types.STRUCT, byte[].class); + sqlTypeToJavaTypeMap.put(Types.SQLXML, byte[].class); + sqlTypeToJavaTypeMap.put(Types.BINARY, byte[].class); + sqlTypeToJavaTypeMap.put(Types.DATALINK, byte[].class); + sqlTypeToJavaTypeMap.put(Types.DISTINCT, byte[].class); + sqlTypeToJavaTypeMap.put(Types.VARBINARY, byte[].class); + sqlTypeToJavaTypeMap.put(Types.JAVA_OBJECT, byte[].class); + sqlTypeToJavaTypeMap.put(Types.LONGVARBINARY, byte[].class); + + // String + sqlTypeToJavaTypeMap.put(Types.CHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.VARCHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.LONGVARCHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.LONGNVARCHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.NCHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.NVARCHAR, String.class); + sqlTypeToJavaTypeMap.put(Types.NCLOB, String.class); + sqlTypeToJavaTypeMap.put(Types.CLOB, String.class); + } + + /** + * 将指定java.sql.Types的ResultSet value转换成相应的String + * + * @param rs + * @param index + * @param sqlType + * @return + * @throws SQLException + */ + public static String sqlValueToString(ResultSet rs, int index, int sqlType) throws SQLException { + Class requiredType = sqlTypeToJavaTypeMap.get(sqlType); + if (requiredType == null) { + throw new IllegalArgumentException("unknow java.sql.Types - " + sqlType); + } + + return getResultSetValue(rs, index, requiredType); + } + + /** + * sqlValueToString方法的逆向过程 + * + * @param value + * @param sqlType + * @param isTextRequired + * @param isEmptyStringNulled + * @return + */ + public static Object stringToSqlValue(String value, int sqlType, boolean isRequired, boolean isEmptyStringNulled) { + // 设置变量 + String sourceValue = value; + if (SqlUtils.isTextType(sqlType)) { + if ((sourceValue == null) || ((true == StringUtils.isEmpty(sourceValue)) && isEmptyStringNulled)) { + return isRequired ? REQUIRED_FIELD_NULL_SUBSTITUTE : null; + } else { + return sourceValue; + } + } else { + if (StringUtils.isEmpty(sourceValue)) { + return null; + } else { + Class requiredType = sqlTypeToJavaTypeMap.get(sqlType); + if (requiredType == null) { + throw new IllegalArgumentException("unknow java.sql.Types - " + sqlType); + } else if (requiredType.equals(String.class)) { + return sourceValue; + } else if (true == isNumeric(sqlType)) { + return convertUtilsBean.convert(sourceValue.trim(), requiredType); + } else { + return convertUtilsBean.convert(sourceValue, requiredType); + } + } + } + } + + public static String encoding(String source, int sqlType, String sourceEncoding, String targetEncoding) { + switch (sqlType) { + case Types.CHAR: + case Types.VARCHAR: + case Types.LONGVARCHAR: + case Types.NCHAR: + case Types.NVARCHAR: + case Types.LONGNVARCHAR: + case Types.CLOB: + case Types.NCLOB: + if (false == StringUtils.isEmpty(source)) { + String fromEncoding = StringUtils.isBlank(sourceEncoding) ? "UTF-8" : sourceEncoding; + String toEncoding = StringUtils.isBlank(targetEncoding) ? "UTF-8" : targetEncoding; + + // if (false == StringUtils.equalsIgnoreCase(fromEncoding, toEncoding)) { + try { + return new String(source.getBytes(fromEncoding), toEncoding); + } catch (UnsupportedEncodingException e) { + throw new IllegalArgumentException(e.getMessage(), e); + } + // } + } + } + + return source; + } + + /** + * Retrieve a JDBC column value from a ResultSet, using the specified value type. + *

+ * Uses the specifically typed ResultSet accessor methods, falling back to + * {@link #getResultSetValue(java.sql.ResultSet, int)} for unknown types. + *

+ * Note that the returned value may not be assignable to the specified required type, in case of an unknown type. + * Calling code needs to deal with this case appropriately, e.g. throwing a corresponding exception. + * + * @param rs is the ResultSet holding the data + * @param index is the column index + * @param requiredType the required value type (may be null) + * @return the value object + * @throws SQLException if thrown by the JDBC API + */ + private static String getResultSetValue(ResultSet rs, int index, Class requiredType) throws SQLException { + if (requiredType == null) { + return getResultSetValue(rs, index); + } + + Object value = null; + boolean wasNullCheck = false; + + // Explicitly extract typed value, as far as possible. + if (String.class.equals(requiredType)) { + value = rs.getString(index); + } else if (boolean.class.equals(requiredType) || Boolean.class.equals(requiredType)) { + value = Boolean.valueOf(rs.getBoolean(index)); + wasNullCheck = true; + } else if (byte.class.equals(requiredType) || Byte.class.equals(requiredType)) { + value = new Byte(rs.getByte(index)); + wasNullCheck = true; + } else if (short.class.equals(requiredType) || Short.class.equals(requiredType)) { + value = new Short(rs.getShort(index)); + wasNullCheck = true; + } else if (int.class.equals(requiredType) || Integer.class.equals(requiredType)) { + value = new Long(rs.getLong(index)); + wasNullCheck = true; + } else if (long.class.equals(requiredType) || Long.class.equals(requiredType)) { + value = rs.getBigDecimal(index); + wasNullCheck = true; + } else if (float.class.equals(requiredType) || Float.class.equals(requiredType)) { + value = new Float(rs.getFloat(index)); + wasNullCheck = true; + } else if (double.class.equals(requiredType) || Double.class.equals(requiredType) + || Number.class.equals(requiredType)) { + value = new Double(rs.getDouble(index)); + wasNullCheck = true; + } else if (java.sql.Time.class.equals(requiredType)) { + value = rs.getTime(index); + } else if (java.sql.Timestamp.class.equals(requiredType) || java.sql.Date.class.equals(requiredType) + || java.sql.Time.class.equals(requiredType) || java.util.Date.class.equals(requiredType)) { + value = convertTimestamp(rs.getTimestamp(index)); + } else if (BigDecimal.class.equals(requiredType)) { + value = rs.getBigDecimal(index); + } else if (Blob.class.equals(requiredType)) { + value = rs.getBlob(index); + } else if (Clob.class.equals(requiredType)) { + value = rs.getClob(index); + } else if (byte[].class.equals(requiredType)) { + value = ArrayUtils.toString(rs.getBytes(index), ""); + } else { + + // Some unknown type desired -> rely on getObject. + value = getResultSetValue(rs, index); + } + + // Perform was-null check if demanded (for results that the + // JDBC driver returns as primitives). + if (wasNullCheck && (value != null) && rs.wasNull()) { + value = null; + } + + return (value == null) ? null : convertUtilsBean.convert(value); + } + + /** + * Retrieve a JDBC column value from a ResultSet, using the most appropriate value type. The returned value should + * be a detached value object, not having any ties to the active ResultSet: in particular, it should not be a Blob + * or Clob object but rather a byte array respectively String representation. + *

+ * Uses the getObject(index) method, but includes additional "hacks" to get around Oracle 10g returning + * a non-standard object for its TIMESTAMP datatype and a java.sql.Date for DATE columns leaving out + * the time portion: These columns will explicitly be extracted as standard java.sql.Timestamp object. + * + * @param rs is the ResultSet holding the data + * @param index is the column index + * @return the value object + * @throws SQLException if thrown by the JDBC API + * @see java.sql.Blob + * @see java.sql.Clob + * @see java.sql.Timestamp + */ + private static String getResultSetValue(ResultSet rs, int index) throws SQLException { + Object obj = rs.getObject(index); + return (obj == null) ? null : convertUtilsBean.convert(obj); + } + + private static Object convertTimestamp(Timestamp timestamp) { + return (timestamp == null) ? null : timestamp.getTime(); + } + + /** + * Check whether the given SQL type is numeric. + */ + public static boolean isNumeric(int sqlType) { + return (Types.BIT == sqlType) || (Types.BIGINT == sqlType) || (Types.DECIMAL == sqlType) + || (Types.DOUBLE == sqlType) || (Types.FLOAT == sqlType) || (Types.INTEGER == sqlType) + || (Types.NUMERIC == sqlType) || (Types.REAL == sqlType) || (Types.SMALLINT == sqlType) + || (Types.TINYINT == sqlType); + } + + public static boolean isTextType(int sqlType) { + if (sqlType == Types.CHAR || sqlType == Types.VARCHAR || sqlType == Types.CLOB || sqlType == Types.LONGVARCHAR + || sqlType == Types.NCHAR || sqlType == Types.NVARCHAR || sqlType == Types.NCLOB + || sqlType == Types.LONGNVARCHAR) { + return true; + } else { + return false; + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptUtils.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptUtils.java index 5f0d11e2..6ac099b6 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptUtils.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptUtils.java @@ -1,47 +1,61 @@ -package com.alibaba.otter.node.etl.common.io; - -import org.apache.commons.lang.StringUtils; - -import com.alibaba.otter.node.etl.common.io.compress.Compressor; -import com.alibaba.otter.node.etl.common.io.compress.impl.gzip.GzipCompressor; -import com.alibaba.otter.node.etl.common.io.crypto.AESUtils; -import com.alibaba.otter.node.etl.common.io.signature.ChecksumException; -import com.alibaba.otter.node.etl.common.io.signature.ChecksumUtils; - -/** - * 数据对象间转换的工具类 - * - * @author jianghang 2011-10-13 下午07:37:46 - * @version 4.0.0 - */ -public class EncryptUtils { - - private static final Compressor COMPRESSOR = new GzipCompressor(); - - public static EncryptedData encrypt(byte[] input) { - // 压缩数据 - byte[] compData = COMPRESSOR.compress(input); - - // 调用加密工具类 - AESUtils aes = new AESUtils(); - aes.generateSecretKey(); - - // 加密数据 - byte[] encryptData = aes.encrypt(compData); - return new EncryptedData(encryptData, aes.getSecretyKeyString(), ChecksumUtils.checksum(encryptData)); - } - - public static byte[] decrypt(EncryptedData encode) { - String destCrc = ChecksumUtils.checksum(encode.getData()); - //验证sign - if (false == StringUtils.equals(encode.getCrc(), destCrc)) { - throw new ChecksumException(String.format("orig: %s, parsed: %s not match", encode.getCrc(), destCrc)); - } - - // 调用加密工具类 - AESUtils aes = new AESUtils(); - aes.setSecretKeyString(encode.getKey()); - // 解密并解压数据 - return COMPRESSOR.decompress(aes.decrypt(encode.getData())); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io; + +import org.apache.commons.lang.StringUtils; + +import com.alibaba.otter.node.etl.common.io.compress.Compressor; +import com.alibaba.otter.node.etl.common.io.compress.impl.gzip.GzipCompressor; +import com.alibaba.otter.node.etl.common.io.crypto.AESUtils; +import com.alibaba.otter.node.etl.common.io.signature.ChecksumException; +import com.alibaba.otter.node.etl.common.io.signature.ChecksumUtils; + +/** + * 数据对象间转换的工具类 + * + * @author jianghang 2011-10-13 下午07:37:46 + * @version 4.0.0 + */ +public class EncryptUtils { + + private static final Compressor COMPRESSOR = new GzipCompressor(); + + public static EncryptedData encrypt(byte[] input) { + // 压缩数据 + byte[] compData = COMPRESSOR.compress(input); + + // 调用加密工具类 + AESUtils aes = new AESUtils(); + aes.generateSecretKey(); + + // 加密数据 + byte[] encryptData = aes.encrypt(compData); + return new EncryptedData(encryptData, aes.getSecretyKeyString(), ChecksumUtils.checksum(encryptData)); + } + + public static byte[] decrypt(EncryptedData encode) { + String destCrc = ChecksumUtils.checksum(encode.getData()); + //验证sign + if (false == StringUtils.equals(encode.getCrc(), destCrc)) { + throw new ChecksumException(String.format("orig: %s, parsed: %s not match", encode.getCrc(), destCrc)); + } + + // 调用加密工具类 + AESUtils aes = new AESUtils(); + aes.setSecretKeyString(encode.getKey()); + // 解密并解压数据 + return COMPRESSOR.decompress(aes.decrypt(encode.getData())); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptedData.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptedData.java index baccea7b..6925dc7b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptedData.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/EncryptedData.java @@ -1,40 +1,54 @@ -package com.alibaba.otter.node.etl.common.io; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * 加密后的数据对象 - * - * @author jianghang 2011-10-9 下午06:10:43 - * @version 4.0.0 - */ -public class EncryptedData { - - private final String crc; - private final byte[] data; - private final String key; - - public EncryptedData(byte[] data, String key, String crc){ - this.data = data; - this.key = key; - this.crc = crc; - } - - public String getCrc() { - return crc; - } - - public byte[] getData() { - return data; - } - - public String getKey() { - return key; - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * 加密后的数据对象 + * + * @author jianghang 2011-10-9 下午06:10:43 + * @version 4.0.0 + */ +public class EncryptedData { + + private final String crc; + private final byte[] data; + private final String key; + + public EncryptedData(byte[] data, String key, String crc){ + this.data = data; + this.key = key; + this.crc = crc; + } + + public String getCrc() { + return crc; + } + + public byte[] getData() { + return data; + } + + public String getKey() { + return key; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/Compressor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/Compressor.java index 07180822..e8a9a295 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/Compressor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/Compressor.java @@ -1,111 +1,125 @@ -package com.alibaba.otter.node.etl.common.io.compress; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; - -import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; - -/** - * The Compressor Interface defines all operations for the compress/decompress actions. - */ -public interface Compressor { - - /** - * Compresses this file and returns an InputStream to the compressed File - * - * @param input File to compress - * @return InputStream of the compressed file - * @throws CompressException if the Compressor reports an error - */ - public InputStream compress(File input) throws CompressException; - - /** - * Compresses this InputStream and returns an InputStream to the compressed file - * - * @param input Stream to compress - * @return Stream to the compressed file - * @throws CompressException if the Compressor reports an error - */ - public InputStream compress(InputStream input) throws CompressException; - - /** - * Compresses this bytes and returns an bytes - * - * @param data - * @return - * @throws CompressException - */ - public byte[] compress(byte[] data) throws CompressException; - - /** - * Compresses the file input and creates a file in the same directory with the default file extension in its name. - * - * @param input the file to compress - * @throws CompressException if the Compressor reports an error - */ - public void compressToHere(File input) throws CompressException; - - /** - * Creates the file "output" with the compressed content of file "input" - * - * @param input the file to compress - * @param output the file to create - * @throws CompressException if the Compressor reports an error - */ - public void compressTo(File input, File output) throws CompressException; - - /** - * Compresses the input stream and writes the compressed bytes to the output stream. This method must be implemented - * by all new compressortypes. - * - * @param input InputStream to compress to - * @param output OutputStream to which the byte shall be written - * @throws CompressException if the Compressor reports an error - */ - public void compressTo(InputStream input, OutputStream output) throws CompressException; - - /** - * Decompresses a file and returns an InputStream - * - * @param input file to decompress - * @return the decompressed file as an inputstream - */ - public InputStream decompress(File input) throws CompressException; - - /** - * Decompresses a file and returns an InputStream - * - * @param input inputstream to decompress - * @return the decompressed InputStream - */ - public InputStream decompress(InputStream input) throws CompressException; - - /** - * Decompresses this bytes and returns an bytes - * - * @param data - * @return - * @throws CompressException - */ - public byte[] decompress(byte[] data) throws CompressException; - - /** - * Decompresses this file and writes the decompressed byte to the output file - * - * @param input File to decompress - * @param output File to write the decompressed bytes to - * @throws CompressException if the Compressor reports an error - */ - public void decompressTo(File input, File output) throws CompressException; - - /** - * Decompresses this file and writes the decompressed file to the output-stream - * - * @param input Stream to decompress - * @param output Stream to write the decompressed bytes to - * @throws CompressException if the Compressor reports an error - */ - public void decompressTo(InputStream input, OutputStream output) throws CompressException; - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; + +import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; + +/** + * The Compressor Interface defines all operations for the compress/decompress actions. + */ +public interface Compressor { + + /** + * Compresses this file and returns an InputStream to the compressed File + * + * @param input File to compress + * @return InputStream of the compressed file + * @throws CompressException if the Compressor reports an error + */ + public InputStream compress(File input) throws CompressException; + + /** + * Compresses this InputStream and returns an InputStream to the compressed file + * + * @param input Stream to compress + * @return Stream to the compressed file + * @throws CompressException if the Compressor reports an error + */ + public InputStream compress(InputStream input) throws CompressException; + + /** + * Compresses this bytes and returns an bytes + * + * @param data + * @return + * @throws CompressException + */ + public byte[] compress(byte[] data) throws CompressException; + + /** + * Compresses the file input and creates a file in the same directory with the default file extension in its name. + * + * @param input the file to compress + * @throws CompressException if the Compressor reports an error + */ + public void compressToHere(File input) throws CompressException; + + /** + * Creates the file "output" with the compressed content of file "input" + * + * @param input the file to compress + * @param output the file to create + * @throws CompressException if the Compressor reports an error + */ + public void compressTo(File input, File output) throws CompressException; + + /** + * Compresses the input stream and writes the compressed bytes to the output stream. This method must be implemented + * by all new compressortypes. + * + * @param input InputStream to compress to + * @param output OutputStream to which the byte shall be written + * @throws CompressException if the Compressor reports an error + */ + public void compressTo(InputStream input, OutputStream output) throws CompressException; + + /** + * Decompresses a file and returns an InputStream + * + * @param input file to decompress + * @return the decompressed file as an inputstream + */ + public InputStream decompress(File input) throws CompressException; + + /** + * Decompresses a file and returns an InputStream + * + * @param input inputstream to decompress + * @return the decompressed InputStream + */ + public InputStream decompress(InputStream input) throws CompressException; + + /** + * Decompresses this bytes and returns an bytes + * + * @param data + * @return + * @throws CompressException + */ + public byte[] decompress(byte[] data) throws CompressException; + + /** + * Decompresses this file and writes the decompressed byte to the output file + * + * @param input File to decompress + * @param output File to write the decompressed bytes to + * @throws CompressException if the Compressor reports an error + */ + public void decompressTo(File input, File output) throws CompressException; + + /** + * Decompresses this file and writes the decompressed file to the output-stream + * + * @param input Stream to decompress + * @param output Stream to write the decompressed bytes to + * @throws CompressException if the Compressor reports an error + */ + public void decompressTo(InputStream input, OutputStream output) throws CompressException; + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/exception/CompressException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/exception/CompressException.java index 317764fa..97e8365c 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/exception/CompressException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/exception/CompressException.java @@ -1,48 +1,62 @@ -package com.alibaba.otter.node.etl.common.io.compress.exception; - -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** - * 压缩异常类 - */ -public class CompressException extends NestableRuntimeException { - - private static final long serialVersionUID = -7288830284122672209L; - - private String errorCode; - private String errorDesc; - - public CompressException(String errorCode){ - super(errorCode); - } - - public CompressException(String errorCode, Throwable cause){ - super(errorCode, cause); - } - - public CompressException(String errorCode, String errorDesc){ - super(errorCode + ":" + errorDesc); - } - - public CompressException(String errorCode, String errorDesc, Throwable cause){ - super(errorCode + ":" + errorDesc, cause); - } - - public CompressException(Throwable cause){ - super(cause); - } - - public String getErrorCode() { - return errorCode; - } - - public String getErrorDesc() { - return errorDesc; - } - - @Override - public Throwable fillInStackTrace() { - return this; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress.exception; + +import org.apache.commons.lang.exception.NestableRuntimeException; + +/** + * 压缩异常类 + */ +public class CompressException extends NestableRuntimeException { + + private static final long serialVersionUID = -7288830284122672209L; + + private String errorCode; + private String errorDesc; + + public CompressException(String errorCode){ + super(errorCode); + } + + public CompressException(String errorCode, Throwable cause){ + super(errorCode, cause); + } + + public CompressException(String errorCode, String errorDesc){ + super(errorCode + ":" + errorDesc); + } + + public CompressException(String errorCode, String errorDesc, Throwable cause){ + super(errorCode + ":" + errorDesc, cause); + } + + public CompressException(Throwable cause){ + super(cause); + } + + public String getErrorCode() { + return errorCode; + } + + public String getErrorDesc() { + return errorDesc; + } + + @Override + public Throwable fillInStackTrace() { + return this; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/AbstractCompressor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/AbstractCompressor.java index 27007dcd..85c11b32 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/AbstractCompressor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/AbstractCompressor.java @@ -1,153 +1,167 @@ -package com.alibaba.otter.node.etl.common.io.compress.impl; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; - -import com.alibaba.otter.node.etl.common.io.compress.Compressor; -import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; - -/** - * AbstractCompressor handles all compression/decompression actions on an abstract basis. - */ -public abstract class AbstractCompressor extends PackableObject implements Compressor { - - public AbstractCompressor(){ - super(); - } - - /** - * Returns a String with the default file extension for this compressor. For example, a zip-files default file - * extension would be "zip" (without leading dot). - * - * @return the default file extension - */ - public abstract String getDefaultFileExtension(); - - public InputStream compress(InputStream input) throws CompressException { - FileOutputStream output = null; - try { - File temp = File.createTempFile("compress_", "jkt"); - output = new FileOutputStream(temp); - //转化为流进行处理 - compressTo(input, output); - return new FileInputStream(temp); - } catch (IOException e) { - throw new CompressException("An I/O Exception has occured", e); - } finally { - IOUtils.closeQuietly(output); - } - } - - public byte[] compress(byte[] data) throws CompressException { - ByteArrayInputStream input = new ByteArrayInputStream(data); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - try { - this.compressTo(input, output); - return output.toByteArray(); - } finally { - IOUtils.closeQuietly(input); - IOUtils.closeQuietly(output); - } - } - - public void compressToHere(File input) throws CompressException { - String pathToFile = input.getAbsolutePath(); - File output = new File(pathToFile); - this.compressTo(input, output); - } - - public void compressTo(File input, File output) throws CompressException { - FileOutputStream outputStream = null; - FileInputStream inputStream = null; - try { - outputStream = new FileOutputStream(output); - inputStream = new FileInputStream(input); - this.compressTo(inputStream, outputStream); - } catch (FileNotFoundException e) { - throw new CompressException("File not found", e); - } finally { - IOUtils.closeQuietly(inputStream); - IOUtils.closeQuietly(outputStream); - } - } - - public InputStream compress(File input) throws CompressException { - FileInputStream inputStream = null; - try { - inputStream = new FileInputStream(input); - return this.compress(inputStream); - } catch (FileNotFoundException e) { - throw new CompressException("File not found", e); - } finally { - IOUtils.closeQuietly(inputStream); - } - } - - public InputStream decompress(File input) throws CompressException { - File temp = null; - InputStream result = null; - try { - temp = File.createTempFile("compress_", "jkt"); - this.decompressTo(input, temp); - result = new FileInputStream(temp); - } catch (IOException e) { - throw new CompressException("Error while creating a temporary file", e); - } - - return result; - } - - public InputStream decompress(InputStream input) throws CompressException { - File temp = null; - InputStream result = null; - FileOutputStream output = null; - try { - temp = File.createTempFile("compress_", "jkt"); - output = new FileOutputStream(temp); - this.decompressTo(input, output); - result = new FileInputStream(temp); - } catch (IOException e) { - throw new CompressException("Error while creating a temporary file", e); - } finally { - IOUtils.closeQuietly(output); - } - - return result; - } - - public byte[] decompress(byte[] data) throws CompressException { - ByteArrayInputStream input = new ByteArrayInputStream(data); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - try { - this.decompressTo(input, output); - return output.toByteArray(); - } finally { - IOUtils.closeQuietly(input); - IOUtils.closeQuietly(output); - } - } - - public void decompressTo(File input, File output) throws CompressException { - FileInputStream inputStream = null; - FileOutputStream outputStream = null; - try { - outputStream = new FileOutputStream(output); - inputStream = new FileInputStream(input); - decompressTo(inputStream, outputStream); - } catch (FileNotFoundException e) { - throw new CompressException("File could not be found", e); - } finally { - IOUtils.closeQuietly(inputStream); - IOUtils.closeQuietly(outputStream); - } - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress.impl; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.apache.commons.io.IOUtils; + +import com.alibaba.otter.node.etl.common.io.compress.Compressor; +import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; + +/** + * AbstractCompressor handles all compression/decompression actions on an abstract basis. + */ +public abstract class AbstractCompressor extends PackableObject implements Compressor { + + public AbstractCompressor(){ + super(); + } + + /** + * Returns a String with the default file extension for this compressor. For example, a zip-files default file + * extension would be "zip" (without leading dot). + * + * @return the default file extension + */ + public abstract String getDefaultFileExtension(); + + public InputStream compress(InputStream input) throws CompressException { + FileOutputStream output = null; + try { + File temp = File.createTempFile("compress_", "jkt"); + output = new FileOutputStream(temp); + //转化为流进行处理 + compressTo(input, output); + return new FileInputStream(temp); + } catch (IOException e) { + throw new CompressException("An I/O Exception has occured", e); + } finally { + IOUtils.closeQuietly(output); + } + } + + public byte[] compress(byte[] data) throws CompressException { + ByteArrayInputStream input = new ByteArrayInputStream(data); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + try { + this.compressTo(input, output); + return output.toByteArray(); + } finally { + IOUtils.closeQuietly(input); + IOUtils.closeQuietly(output); + } + } + + public void compressToHere(File input) throws CompressException { + String pathToFile = input.getAbsolutePath(); + File output = new File(pathToFile); + this.compressTo(input, output); + } + + public void compressTo(File input, File output) throws CompressException { + FileOutputStream outputStream = null; + FileInputStream inputStream = null; + try { + outputStream = new FileOutputStream(output); + inputStream = new FileInputStream(input); + this.compressTo(inputStream, outputStream); + } catch (FileNotFoundException e) { + throw new CompressException("File not found", e); + } finally { + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + } + } + + public InputStream compress(File input) throws CompressException { + FileInputStream inputStream = null; + try { + inputStream = new FileInputStream(input); + return this.compress(inputStream); + } catch (FileNotFoundException e) { + throw new CompressException("File not found", e); + } finally { + IOUtils.closeQuietly(inputStream); + } + } + + public InputStream decompress(File input) throws CompressException { + File temp = null; + InputStream result = null; + try { + temp = File.createTempFile("compress_", "jkt"); + this.decompressTo(input, temp); + result = new FileInputStream(temp); + } catch (IOException e) { + throw new CompressException("Error while creating a temporary file", e); + } + + return result; + } + + public InputStream decompress(InputStream input) throws CompressException { + File temp = null; + InputStream result = null; + FileOutputStream output = null; + try { + temp = File.createTempFile("compress_", "jkt"); + output = new FileOutputStream(temp); + this.decompressTo(input, output); + result = new FileInputStream(temp); + } catch (IOException e) { + throw new CompressException("Error while creating a temporary file", e); + } finally { + IOUtils.closeQuietly(output); + } + + return result; + } + + public byte[] decompress(byte[] data) throws CompressException { + ByteArrayInputStream input = new ByteArrayInputStream(data); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + try { + this.decompressTo(input, output); + return output.toByteArray(); + } finally { + IOUtils.closeQuietly(input); + IOUtils.closeQuietly(output); + } + } + + public void decompressTo(File input, File output) throws CompressException { + FileInputStream inputStream = null; + FileOutputStream outputStream = null; + try { + outputStream = new FileOutputStream(output); + inputStream = new FileInputStream(input); + decompressTo(inputStream, outputStream); + } catch (FileNotFoundException e) { + throw new CompressException("File could not be found", e); + } finally { + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + } + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/PackableObject.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/PackableObject.java index ab3d9362..13fe93ef 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/PackableObject.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/PackableObject.java @@ -1,129 +1,143 @@ -package com.alibaba.otter.node.etl.common.io.compress.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Abstract super object for Compressor and Archiver classes. - */ -public abstract class PackableObject { - - /* Type for archive choosing: String */ - protected static final int CHOOSE_EXTENSION = 1; - - /* Type for archive choosing: Long */ - protected static final int CHOOSE_NAME = 2; - - protected final Logger logger = LoggerFactory.getLogger(getClass()); - - /** - * Header byte array for this archive. - */ - public abstract byte[] getHeader(); - - /** - * Returns the default FileExtension for this archive, for example "zip", "tar"... - */ - public abstract String getDefaultFileExtension(); - - /** - * Returns the ArchiveName for this archive. - */ - public abstract String getName(); - - /** - * String Chooser. - */ - protected boolean isPackableWith(Object value, int choose) { - if (value == null) { - return false; - } - - if (choose == CHOOSE_EXTENSION) { - if (value.equals(getDefaultFileExtension())) { - return true; - } - } else if (choose == CHOOSE_NAME) { - if (value.equals(getName())) { - return true; - } - } - - return false; - } - - /** - * Compares a file to a list of packables and identifies an object by header. If no matching header is found, it - * identifies the file by file extension. If identification was not successfull, null is returned - * - * @param file the file to identify - * @param packables a list of packables - * @return a matching packable object, or null - * @throws IOException - */ - public static PackableObject identifyByHeader(File file, List packables) throws IOException { - FileInputStream fis = null; - try { - /* Archive result */ - // PackableObject packable = null; - // identify archive by header - fis = new FileInputStream(file); - byte[] headerBytes = new byte[20]; - fis.read(headerBytes, 0, 20); - - Iterator iter = packables.iterator(); - while (iter.hasNext()) { - PackableObject p = (PackableObject) iter.next(); - byte[] fieldHeader = p.getHeader(); - - if (fieldHeader != null) { - if (compareByteArrays(headerBytes, fieldHeader)) { - return p; - } - } - } - - // if we couldn't find an archiver by header bytes, we'll give it a try - // with the default name extension. This is useful, cause some archives - // like tar have no header. - String name = file.getName(); - String extension = null; - String[] s = name.split("\\."); - - if (s.length > 1) { - extension = s[s.length - 1]; - } - - Iterator it = packables.iterator(); - - while (it.hasNext()) { - PackableObject p = (PackableObject) it.next(); - if (p.isPackableWith(extension, PackableObject.CHOOSE_EXTENSION)) { - return p; - } - } - // No implementation found - return null; - } finally { - IOUtils.closeQuietly(fis); - } - } - - private static boolean compareByteArrays(byte[] source, byte[] match) { - int i = 0; - while ((source.length < i) || (i < match.length)) { - if (source[i] != match[i]) { - return false; - } - i++; - } - return true; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract super object for Compressor and Archiver classes. + */ +public abstract class PackableObject { + + /* Type for archive choosing: String */ + protected static final int CHOOSE_EXTENSION = 1; + + /* Type for archive choosing: Long */ + protected static final int CHOOSE_NAME = 2; + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * Header byte array for this archive. + */ + public abstract byte[] getHeader(); + + /** + * Returns the default FileExtension for this archive, for example "zip", "tar"... + */ + public abstract String getDefaultFileExtension(); + + /** + * Returns the ArchiveName for this archive. + */ + public abstract String getName(); + + /** + * String Chooser. + */ + protected boolean isPackableWith(Object value, int choose) { + if (value == null) { + return false; + } + + if (choose == CHOOSE_EXTENSION) { + if (value.equals(getDefaultFileExtension())) { + return true; + } + } else if (choose == CHOOSE_NAME) { + if (value.equals(getName())) { + return true; + } + } + + return false; + } + + /** + * Compares a file to a list of packables and identifies an object by header. If no matching header is found, it + * identifies the file by file extension. If identification was not successfull, null is returned + * + * @param file the file to identify + * @param packables a list of packables + * @return a matching packable object, or null + * @throws IOException + */ + public static PackableObject identifyByHeader(File file, List packables) throws IOException { + FileInputStream fis = null; + try { + /* Archive result */ + // PackableObject packable = null; + // identify archive by header + fis = new FileInputStream(file); + byte[] headerBytes = new byte[20]; + fis.read(headerBytes, 0, 20); + + Iterator iter = packables.iterator(); + while (iter.hasNext()) { + PackableObject p = (PackableObject) iter.next(); + byte[] fieldHeader = p.getHeader(); + + if (fieldHeader != null) { + if (compareByteArrays(headerBytes, fieldHeader)) { + return p; + } + } + } + + // if we couldn't find an archiver by header bytes, we'll give it a try + // with the default name extension. This is useful, cause some archives + // like tar have no header. + String name = file.getName(); + String extension = null; + String[] s = name.split("\\."); + + if (s.length > 1) { + extension = s[s.length - 1]; + } + + Iterator it = packables.iterator(); + + while (it.hasNext()) { + PackableObject p = (PackableObject) it.next(); + if (p.isPackableWith(extension, PackableObject.CHOOSE_EXTENSION)) { + return p; + } + } + // No implementation found + return null; + } finally { + IOUtils.closeQuietly(fis); + } + } + + private static boolean compareByteArrays(byte[] source, byte[] match) { + int i = 0; + while ((source.length < i) || (i < match.length)) { + if (source[i] != match[i]) { + return false; + } + i++; + } + return true; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/bzip2/BZip2Compressor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/bzip2/BZip2Compressor.java index 00142b78..5d30d08d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/bzip2/BZip2Compressor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/bzip2/BZip2Compressor.java @@ -1,67 +1,81 @@ -package com.alibaba.otter.node.etl.common.io.compress.impl.bzip2; - -import java.io.InputStream; -import java.io.OutputStream; - -import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; -import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; - -import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; -import com.alibaba.otter.node.etl.common.io.compress.impl.AbstractCompressor; -import com.alibaba.otter.shared.common.utils.NioUtils; - -/** - * Implementation of the Compressor Interface for BZip2. - * - * @author brave.taoy - * @author jianghang 2011-10-9 下午02:33:57 - * @version 4.0.0 - */ -public class BZip2Compressor extends AbstractCompressor { - - /* Default file extension */ - private static String DEFAULT_FILE_EXTENSION = "bz2"; - - /* Header BZ as byte-Array */ - private static final byte[] HEADER = new byte[] { (byte) 'B', (byte) 'Z', (byte) 'h' }; - - /* Name of this implementation */ - private static final String NAME = "bz2"; - - public BZip2Compressor(){ - super(); - } - - public void compressTo(InputStream in, OutputStream out) throws CompressException { - BZip2CompressorOutputStream outputBZStream = null; - try { - outputBZStream = new BZip2CompressorOutputStream(out); - NioUtils.copy(in, outputBZStream); - outputBZStream.finish(); - } catch (Exception e) { - throw new CompressException("bzip_compress_error", e); - } - } - - public void decompressTo(InputStream in, OutputStream out) throws CompressException { - BZip2CompressorInputStream inputStream = null; - try { - inputStream = new BZip2CompressorInputStream(in); - NioUtils.copy(inputStream, out); - } catch (Exception e) { - throw new CompressException("bzip_decompress_error", e); - } - } - - public byte[] getHeader() { - return HEADER; - } - - public String getName() { - return NAME; - } - - public String getDefaultFileExtension() { - return DEFAULT_FILE_EXTENSION; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress.impl.bzip2; + +import java.io.InputStream; +import java.io.OutputStream; + +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; + +import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; +import com.alibaba.otter.node.etl.common.io.compress.impl.AbstractCompressor; +import com.alibaba.otter.shared.common.utils.NioUtils; + +/** + * Implementation of the Compressor Interface for BZip2. + * + * @author brave.taoy + * @author jianghang 2011-10-9 下午02:33:57 + * @version 4.0.0 + */ +public class BZip2Compressor extends AbstractCompressor { + + /* Default file extension */ + private static String DEFAULT_FILE_EXTENSION = "bz2"; + + /* Header BZ as byte-Array */ + private static final byte[] HEADER = new byte[] { (byte) 'B', (byte) 'Z', (byte) 'h' }; + + /* Name of this implementation */ + private static final String NAME = "bz2"; + + public BZip2Compressor(){ + super(); + } + + public void compressTo(InputStream in, OutputStream out) throws CompressException { + BZip2CompressorOutputStream outputBZStream = null; + try { + outputBZStream = new BZip2CompressorOutputStream(out); + NioUtils.copy(in, outputBZStream); + outputBZStream.finish(); + } catch (Exception e) { + throw new CompressException("bzip_compress_error", e); + } + } + + public void decompressTo(InputStream in, OutputStream out) throws CompressException { + BZip2CompressorInputStream inputStream = null; + try { + inputStream = new BZip2CompressorInputStream(in); + NioUtils.copy(inputStream, out); + } catch (Exception e) { + throw new CompressException("bzip_decompress_error", e); + } + } + + public byte[] getHeader() { + return HEADER; + } + + public String getName() { + return NAME; + } + + public String getDefaultFileExtension() { + return DEFAULT_FILE_EXTENSION; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/gzip/GzipCompressor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/gzip/GzipCompressor.java index d4c738bd..5c9fe144 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/gzip/GzipCompressor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/compress/impl/gzip/GzipCompressor.java @@ -1,82 +1,96 @@ -package com.alibaba.otter.node.etl.common.io.compress.impl.gzip; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.Deflater; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; - -import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; -import com.alibaba.otter.node.etl.common.io.compress.impl.AbstractCompressor; -import com.alibaba.otter.shared.common.utils.NioUtils; - -/** - * 基于gzip的压缩实现 - * - * @author jianghang 2011-10-9 下午03:17:08 - * @version 4.0.0 - */ -public class GzipCompressor extends AbstractCompressor { - - /* Default file extension */ - private static String DEFAULT_FILE_EXTENSION = "gzip"; - - /* Name of this implementation */ - private static final String NAME = "gzip"; - - /* - * GZIP header magic number. - */ - private final static int GZIP_MAGIC = 0x8b1f; - - /* Header BZ as byte-Array */ - private static final byte[] HEADER = new byte[] { (byte) GZIP_MAGIC, // Magic number (short) - (byte) (GZIP_MAGIC >> 8), // Magic number (short) - Deflater.DEFLATED, // Compression method (CM) - 0, // Flags (FLG) - 0, // Modification time MTIME (int) - 0, // Modification time MTIME (int) - 0, // Modification time MTIME (int) - 0, // Modification time MTIME (int) - 0, // Extra flags (XFLG) - 0 // Operating system (OS) - }; - - public GzipCompressor(){ - super(); - } - - public void compressTo(InputStream in, OutputStream out) throws CompressException { - GZIPOutputStream gzipOut = null; - try { - gzipOut = new GZIPOutputStream(out); - NioUtils.copy(in, gzipOut); - gzipOut.finish(); //需要使用finish - } catch (Exception e) { - throw new CompressException("gzip_compress_error", e); - } - } - - public void decompressTo(InputStream in, OutputStream out) throws CompressException { - GZIPInputStream gzipin = null; - try { - gzipin = new GZIPInputStream(in); - NioUtils.copy(gzipin, out); - out.flush(); - } catch (Exception e) { - throw new CompressException("gzip_decompress_error", e); - } - } - - public byte[] getHeader() { - return HEADER; - } - - public String getName() { - return NAME; - } - - public String getDefaultFileExtension() { - return DEFAULT_FILE_EXTENSION; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.compress.impl.gzip; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.Deflater; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import com.alibaba.otter.node.etl.common.io.compress.exception.CompressException; +import com.alibaba.otter.node.etl.common.io.compress.impl.AbstractCompressor; +import com.alibaba.otter.shared.common.utils.NioUtils; + +/** + * 基于gzip的压缩实现 + * + * @author jianghang 2011-10-9 下午03:17:08 + * @version 4.0.0 + */ +public class GzipCompressor extends AbstractCompressor { + + /* Default file extension */ + private static String DEFAULT_FILE_EXTENSION = "gzip"; + + /* Name of this implementation */ + private static final String NAME = "gzip"; + + /* + * GZIP header magic number. + */ + private final static int GZIP_MAGIC = 0x8b1f; + + /* Header BZ as byte-Array */ + private static final byte[] HEADER = new byte[] { (byte) GZIP_MAGIC, // Magic number (short) + (byte) (GZIP_MAGIC >> 8), // Magic number (short) + Deflater.DEFLATED, // Compression method (CM) + 0, // Flags (FLG) + 0, // Modification time MTIME (int) + 0, // Modification time MTIME (int) + 0, // Modification time MTIME (int) + 0, // Modification time MTIME (int) + 0, // Extra flags (XFLG) + 0 // Operating system (OS) + }; + + public GzipCompressor(){ + super(); + } + + public void compressTo(InputStream in, OutputStream out) throws CompressException { + GZIPOutputStream gzipOut = null; + try { + gzipOut = new GZIPOutputStream(out); + NioUtils.copy(in, gzipOut); + gzipOut.finish(); //需要使用finish + } catch (Exception e) { + throw new CompressException("gzip_compress_error", e); + } + } + + public void decompressTo(InputStream in, OutputStream out) throws CompressException { + GZIPInputStream gzipin = null; + try { + gzipin = new GZIPInputStream(in); + NioUtils.copy(gzipin, out); + out.flush(); + } catch (Exception e) { + throw new CompressException("gzip_decompress_error", e); + } + } + + public byte[] getHeader() { + return HEADER; + } + + public String getName() { + return NAME; + } + + public String getDefaultFileExtension() { + return DEFAULT_FILE_EXTENSION; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESException.java index 1fc3906c..50c1640f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESException.java @@ -1,48 +1,62 @@ -package com.alibaba.otter.node.etl.common.io.crypto; - -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** - * DES exception - */ -public class AESException extends NestableRuntimeException { - - private static final long serialVersionUID = -7288830284122672209L; - - private String errorCode; - private String errorDesc; - - public AESException(String errorCode){ - super(errorCode); - } - - public AESException(String errorCode, Throwable cause){ - super(errorCode, cause); - } - - public AESException(String errorCode, String errorDesc){ - super(errorCode + ":" + errorDesc); - } - - public AESException(String errorCode, String errorDesc, Throwable cause){ - super(errorCode + ":" + errorDesc, cause); - } - - public AESException(Throwable cause){ - super(cause); - } - - public String getErrorCode() { - return errorCode; - } - - public String getErrorDesc() { - return errorDesc; - } - - @Override - public Throwable fillInStackTrace() { - return this; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.crypto; + +import org.apache.commons.lang.exception.NestableRuntimeException; + +/** + * DES exception + */ +public class AESException extends NestableRuntimeException { + + private static final long serialVersionUID = -7288830284122672209L; + + private String errorCode; + private String errorDesc; + + public AESException(String errorCode){ + super(errorCode); + } + + public AESException(String errorCode, Throwable cause){ + super(errorCode, cause); + } + + public AESException(String errorCode, String errorDesc){ + super(errorCode + ":" + errorDesc); + } + + public AESException(String errorCode, String errorDesc, Throwable cause){ + super(errorCode + ":" + errorDesc, cause); + } + + public AESException(Throwable cause){ + super(cause); + } + + public String getErrorCode() { + return errorCode; + } + + public String getErrorDesc() { + return errorDesc; + } + + @Override + public Throwable fillInStackTrace() { + return this; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESUtils.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESUtils.java index b76e3852..b61be17b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESUtils.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/crypto/AESUtils.java @@ -1,121 +1,135 @@ -package com.alibaba.otter.node.etl.common.io.crypto; - -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; - -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.KeyGenerator; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - -import com.alibaba.otter.shared.common.utils.ByteUtils; - -/** - * 加密算法的实现 - * - * @author jianghang 2011-10-9 下午05:31:00 - * @version 4.0.0 - */ -public class AESUtils { - - private static final String ENCRYPTION_ALGORITHM = "AES"; - private static final int KEY_SIZE = 128; - private byte[] secretKey; - - /** - * 生成AES密钥 - * - * @return Secret key - * @throws AESException AES exception - */ - public byte[] generateSecretKey() throws AESException { - try { - // Get the KeyGenerator - KeyGenerator kgen = KeyGenerator.getInstance(ENCRYPTION_ALGORITHM); - kgen.init(KEY_SIZE); // 192 and 256 bits may not be available - // Generate the secret key specs. - SecretKey skey = kgen.generateKey(); - secretKey = skey.getEncoded(); - return secretKey; - } catch (NoSuchAlgorithmException e) { - throw new AESException(e); - } - } - - /** - * 加密byte数据 - * - * @param plainData - * @return - * @throws AESException - */ - public byte[] encrypt(byte[] plainData) throws AESException { - try { - SecretKeySpec skeySpec = new SecretKeySpec(secretKey, ENCRYPTION_ALGORITHM); - // Instantiate the cipher - Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec); - return cipher.doFinal(plainData); - } catch (NoSuchAlgorithmException e) { - throw new AESException(e); - } catch (NoSuchPaddingException e) { - throw new AESException(e); - } catch (InvalidKeyException e) { - throw new AESException(e); - } catch (IllegalBlockSizeException e) { - throw new AESException(e); - } catch (BadPaddingException e) { - throw new AESException(e); - } - } - - /** - * 解密byte数据 - * - * @param encrypted - * @return - * @throws AESException - */ - public byte[] decrypt(byte[] encrypted) throws AESException { - try { - SecretKeySpec skeySpec = new SecretKeySpec(secretKey, ENCRYPTION_ALGORITHM); - Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); - cipher.init(Cipher.DECRYPT_MODE, skeySpec); - return cipher.doFinal(encrypted); - } catch (NoSuchAlgorithmException e) { - throw new AESException(e); - } catch (NoSuchPaddingException e) { - throw new AESException(e); - } catch (InvalidKeyException e) { - throw new AESException(e); - } catch (IllegalBlockSizeException e) { - throw new AESException(e); - } catch (BadPaddingException e) { - throw new AESException(e); - } - } - - /** - * 获取生成的加密密钥 - * - * @return - */ - public String getSecretyKeyString() { - return ByteUtils.bytesToBase64String(secretKey); - } - - public byte[] getSecretKey() { - return secretKey; - } - - public void setSecretKey(byte[] secretKey) { - this.secretKey = secretKey; - } - - public void setSecretKeyString(String keyString) { - this.secretKey = ByteUtils.base64StringToBytes(keyString); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.crypto; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import com.alibaba.otter.shared.common.utils.ByteUtils; + +/** + * 加密算法的实现 + * + * @author jianghang 2011-10-9 下午05:31:00 + * @version 4.0.0 + */ +public class AESUtils { + + private static final String ENCRYPTION_ALGORITHM = "AES"; + private static final int KEY_SIZE = 128; + private byte[] secretKey; + + /** + * 生成AES密钥 + * + * @return Secret key + * @throws AESException AES exception + */ + public byte[] generateSecretKey() throws AESException { + try { + // Get the KeyGenerator + KeyGenerator kgen = KeyGenerator.getInstance(ENCRYPTION_ALGORITHM); + kgen.init(KEY_SIZE); // 192 and 256 bits may not be available + // Generate the secret key specs. + SecretKey skey = kgen.generateKey(); + secretKey = skey.getEncoded(); + return secretKey; + } catch (NoSuchAlgorithmException e) { + throw new AESException(e); + } + } + + /** + * 加密byte数据 + * + * @param plainData + * @return + * @throws AESException + */ + public byte[] encrypt(byte[] plainData) throws AESException { + try { + SecretKeySpec skeySpec = new SecretKeySpec(secretKey, ENCRYPTION_ALGORITHM); + // Instantiate the cipher + Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, skeySpec); + return cipher.doFinal(plainData); + } catch (NoSuchAlgorithmException e) { + throw new AESException(e); + } catch (NoSuchPaddingException e) { + throw new AESException(e); + } catch (InvalidKeyException e) { + throw new AESException(e); + } catch (IllegalBlockSizeException e) { + throw new AESException(e); + } catch (BadPaddingException e) { + throw new AESException(e); + } + } + + /** + * 解密byte数据 + * + * @param encrypted + * @return + * @throws AESException + */ + public byte[] decrypt(byte[] encrypted) throws AESException { + try { + SecretKeySpec skeySpec = new SecretKeySpec(secretKey, ENCRYPTION_ALGORITHM); + Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, skeySpec); + return cipher.doFinal(encrypted); + } catch (NoSuchAlgorithmException e) { + throw new AESException(e); + } catch (NoSuchPaddingException e) { + throw new AESException(e); + } catch (InvalidKeyException e) { + throw new AESException(e); + } catch (IllegalBlockSizeException e) { + throw new AESException(e); + } catch (BadPaddingException e) { + throw new AESException(e); + } + } + + /** + * 获取生成的加密密钥 + * + * @return + */ + public String getSecretyKeyString() { + return ByteUtils.bytesToBase64String(secretKey); + } + + public byte[] getSecretKey() { + return secretKey; + } + + public void setSecretKey(byte[] secretKey) { + this.secretKey = secretKey; + } + + public void setSecretKeyString(String keyString) { + this.secretKey = ByteUtils.base64StringToBytes(keyString); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetriever.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetriever.java index 0ee412bb..f54b994b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetriever.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetriever.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io.download; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetrieverFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetrieverFactory.java index 5758d560..7c41f9eb 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetrieverFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DataRetrieverFactory.java @@ -1,34 +1,48 @@ -package com.alibaba.otter.node.etl.common.io.download; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; - -import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; -import com.alibaba.otter.node.etl.common.io.download.impl.aria2c.Aria2cRetriever; -import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter.RetrieverType; - -/** - * DataRetriever工厂,选择合适的下载器 - * - * @author jianghang 2011-11-3 下午07:42:05 - * @version 4.0.0 - */ -public class DataRetrieverFactory { - - public DataRetriever createRetriever(RetrieverType type, String url, String targetDir) { - if (type.isAria2c()) { - return getAria2cRetriever(type.getExe(), url, targetDir); - } else { - // 其他的类型 - } - - throw new DataRetrieveException("no DataRetriever for[" + type + "]"); - } - - private DataRetriever getAria2cRetriever(String cmd, String url, String targetDir) { - if (StringUtils.isEmpty(cmd)) { - cmd = (SystemUtils.IS_OS_WINDOWS ? cmd + ".exe" : cmd); - } - return new Aria2cRetriever(cmd, url, targetDir); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.SystemUtils; + +import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; +import com.alibaba.otter.node.etl.common.io.download.impl.aria2c.Aria2cRetriever; +import com.alibaba.otter.shared.common.model.config.parameter.SystemParameter.RetrieverType; + +/** + * DataRetriever工厂,选择合适的下载器 + * + * @author jianghang 2011-11-3 下午07:42:05 + * @version 4.0.0 + */ +public class DataRetrieverFactory { + + public DataRetriever createRetriever(RetrieverType type, String url, String targetDir) { + if (type.isAria2c()) { + return getAria2cRetriever(type.getExe(), url, targetDir); + } else { + // 其他的类型 + } + + throw new DataRetrieveException("no DataRetriever for[" + type + "]"); + } + + private DataRetriever getAria2cRetriever(String cmd, String url, String targetDir) { + if (StringUtils.isEmpty(cmd)) { + cmd = (SystemUtils.IS_OS_WINDOWS ? cmd + ".exe" : cmd); + } + return new Aria2cRetriever(cmd, url, targetDir); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/Download.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/Download.java index b02c5ac8..68f8d759 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/Download.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/Download.java @@ -1,17 +1,31 @@ -package com.alibaba.otter.node.etl.common.io.download; - -//~--- JDK imports ------------------------------------------------------------ - -import java.io.File; - -/** - * @author brave.taoy - */ -public interface Download { - - public long getContentLength(); - - public File getAssociatedLocalFile(); - - public byte[] getAssociatedMemoryData(); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.File; + +/** + * @author brave.taoy + */ +public interface Download { + + public long getContentLength(); + + public File getAssociatedLocalFile(); + + public byte[] getAssociatedMemoryData(); +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DownloadStatus.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DownloadStatus.java index 6b53f5eb..022708ac 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DownloadStatus.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/DownloadStatus.java @@ -1,21 +1,35 @@ -package com.alibaba.otter.node.etl.common.io.download; - -/** - * Enum description - */ -public enum DownloadStatus { - - RUNNING("Downloading"), EXCEPTION("Error"), COMPLETE("Done"), ABORT("Abort"), CONNECTING("Connecting"), - IDLE("Idle"), PAUSED("Paused"), RETRYING("Retrying"), REDIRECTING("Redirecting"), CONNECTED("Connected"), - PAUSING("Pausing"); - - private String title; - - DownloadStatus(String title){ - this.title = title; - } - - public String title() { - return title; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download; + +/** + * Enum description + */ +public enum DownloadStatus { + + RUNNING("Downloading"), EXCEPTION("Error"), COMPLETE("Done"), ABORT("Abort"), CONNECTING("Connecting"), + IDLE("Idle"), PAUSED("Paused"), RETRYING("Retrying"), REDIRECTING("Redirecting"), CONNECTED("Connected"), + PAUSING("Pausing"); + + private String title; + + DownloadStatus(String title){ + this.title = title; + } + + public String title() { + return title; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/exception/DataRetrieveException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/exception/DataRetrieveException.java index 21845e02..d828b742 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/exception/DataRetrieveException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/exception/DataRetrieveException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io.download.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandDownload.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandDownload.java index 605ca85f..973d9e11 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandDownload.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandDownload.java @@ -1,150 +1,164 @@ -package com.alibaba.otter.node.etl.common.io.download.impl; - -import java.io.File; -import java.io.IOException; -import java.util.Observable; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.commons.lang.SystemUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.etl.common.io.download.Download; -import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; -import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; -import com.alibaba.otter.shared.common.utils.NioUtils; -import com.alibaba.otter.shared.common.utils.cmd.Exec; - -public abstract class AbstractCommandDownload extends Observable implements Download { - - protected final Logger logger = LoggerFactory.getLogger(getClass()); - protected AtomicBoolean aborted; - protected String cmd; - protected AtomicBoolean completed; - protected AtomicBoolean paused; - protected DownloadStatus status; - protected String targetDir; - protected File targetFile; - protected String url; - - public AbstractCommandDownload(String cmdPath, String url, String dir, String[] params){ - this.url = url; - // 下载文件名 - String fileName = url.substring(url.lastIndexOf("/") + 1).replace("%20", " "); - // 下载到本地目录 - this.targetDir = dir; - // 目标文件 - this.targetFile = new File(this.targetDir, fileName); - this.buildCmd(cmdPath, params); - // 下载完成状态 - completed = new AtomicBoolean(false); - // 无法下载 - aborted = new AtomicBoolean(false); - // 下载发生异常, 可断点恢复 - paused = new AtomicBoolean(false); - // idle - status = DownloadStatus.IDLE; - } - - public void download() throws IOException { - // 准备下载 - notifyStatusChange(DownloadStatus.CONNECTING); - Exec.Result result = null; - try { - result = Exec.execute(cmd); - if (false == this.isSuccess(result.getExitCode())) { - aborted.set(true); - notifyException(new DataRetrieveException(result.toString())); - notifyStatusChange(DownloadStatus.EXCEPTION); - } else { - this.analyzeResult(result); - this.notifyMessage(result.toString()); - - if (aborted.get()) { - // 中断 - notifyStatusChange(DownloadStatus.ABORT); - } else if (paused.get()) { - // 暂停 - notifyStatusChange(DownloadStatus.PAUSED); - } else { - // 下载完成 - notifyStatusChange(DownloadStatus.COMPLETE); - } - } - } catch (Exception ex) { - aborted.set(true); - notifyException(new DataRetrieveException((result != null) ? ex.getMessage() + SystemUtils.LINE_SEPARATOR - + result.toString() : ex.getMessage(), ex)); - } - - } - - protected abstract void buildCmd(String cmdPath, String[] params); - - protected abstract void analyzeResult(Exec.Result result); - - protected boolean isSuccess(int exitValue) { - return exitValue == 0; - } - - public DownloadStatus getStatus() { - return status; - } - - public boolean isPaused() { - return paused.get(); - } - - public boolean isAborted() { - return aborted.get(); - } - - public boolean isCompleted() { - return completed.get(); - } - - public String getUrl() { - return url; - } - - public byte[] getAssociatedMemoryData() { - if (this.targetFile.exists()) { - try { - return NioUtils.read(this.targetFile); - } catch (IOException e) { - throw new DataRetrieveException(e); - } - } else { - return new byte[] { (byte) 0 }; - } - } - - public long getContentLength() { - if (this.targetFile.exists()) { - return this.targetFile.length(); - } - return 0; - } - - public File getAssociatedLocalFile() { - return this.targetFile; - } - - protected void notifyMessage(String msg) { - notifyEvent(msg); - } - - protected void notifyStatusChange(DownloadStatus status) { - this.status = status; - notifyEvent(status); - } - - protected void notifyException(Exception ex) { - notifyEvent(ex); - } - - protected void notifyEvent(Object arg) { - setChanged(); - notifyObservers(arg); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl; + +import java.io.File; +import java.io.IOException; +import java.util.Observable; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.apache.commons.lang.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.etl.common.io.download.Download; +import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; +import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; +import com.alibaba.otter.shared.common.utils.NioUtils; +import com.alibaba.otter.shared.common.utils.cmd.Exec; + +public abstract class AbstractCommandDownload extends Observable implements Download { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + protected AtomicBoolean aborted; + protected String cmd; + protected AtomicBoolean completed; + protected AtomicBoolean paused; + protected DownloadStatus status; + protected String targetDir; + protected File targetFile; + protected String url; + + public AbstractCommandDownload(String cmdPath, String url, String dir, String[] params){ + this.url = url; + // 下载文件名 + String fileName = url.substring(url.lastIndexOf("/") + 1).replace("%20", " "); + // 下载到本地目录 + this.targetDir = dir; + // 目标文件 + this.targetFile = new File(this.targetDir, fileName); + this.buildCmd(cmdPath, params); + // 下载完成状态 + completed = new AtomicBoolean(false); + // 无法下载 + aborted = new AtomicBoolean(false); + // 下载发生异常, 可断点恢复 + paused = new AtomicBoolean(false); + // idle + status = DownloadStatus.IDLE; + } + + public void download() throws IOException { + // 准备下载 + notifyStatusChange(DownloadStatus.CONNECTING); + Exec.Result result = null; + try { + result = Exec.execute(cmd); + if (false == this.isSuccess(result.getExitCode())) { + aborted.set(true); + notifyException(new DataRetrieveException(result.toString())); + notifyStatusChange(DownloadStatus.EXCEPTION); + } else { + this.analyzeResult(result); + this.notifyMessage(result.toString()); + + if (aborted.get()) { + // 中断 + notifyStatusChange(DownloadStatus.ABORT); + } else if (paused.get()) { + // 暂停 + notifyStatusChange(DownloadStatus.PAUSED); + } else { + // 下载完成 + notifyStatusChange(DownloadStatus.COMPLETE); + } + } + } catch (Exception ex) { + aborted.set(true); + notifyException(new DataRetrieveException((result != null) ? ex.getMessage() + SystemUtils.LINE_SEPARATOR + + result.toString() : ex.getMessage(), ex)); + } + + } + + protected abstract void buildCmd(String cmdPath, String[] params); + + protected abstract void analyzeResult(Exec.Result result); + + protected boolean isSuccess(int exitValue) { + return exitValue == 0; + } + + public DownloadStatus getStatus() { + return status; + } + + public boolean isPaused() { + return paused.get(); + } + + public boolean isAborted() { + return aborted.get(); + } + + public boolean isCompleted() { + return completed.get(); + } + + public String getUrl() { + return url; + } + + public byte[] getAssociatedMemoryData() { + if (this.targetFile.exists()) { + try { + return NioUtils.read(this.targetFile); + } catch (IOException e) { + throw new DataRetrieveException(e); + } + } else { + return new byte[] { (byte) 0 }; + } + } + + public long getContentLength() { + if (this.targetFile.exists()) { + return this.targetFile.length(); + } + return 0; + } + + public File getAssociatedLocalFile() { + return this.targetFile; + } + + protected void notifyMessage(String msg) { + notifyEvent(msg); + } + + protected void notifyStatusChange(DownloadStatus status) { + this.status = status; + notifyEvent(status); + } + + protected void notifyException(Exception ex) { + notifyEvent(ex); + } + + protected void notifyEvent(Object arg) { + setChanged(); + notifyObservers(arg); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandRetriever.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandRetriever.java index b1ac94dd..4071fbaf 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandRetriever.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/AbstractCommandRetriever.java @@ -1,95 +1,109 @@ -package com.alibaba.otter.node.etl.common.io.download.impl; - -import java.io.File; -import java.io.IOException; -import java.util.Observer; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.etl.common.io.download.DataRetriever; -import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; -import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultExceptionObserver; -import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultProgressObserver; -import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultStatusObserver; -import com.alibaba.otter.shared.common.utils.NioUtils; - -/** - * 基于命令行工具的下载 - * - * @author jianghang 2011-10-10 下午05:43:24 - * @version 4.0.0 - */ -public abstract class AbstractCommandRetriever implements DataRetriever { - - protected final Logger logger = LoggerFactory.getLogger(getClass()); - protected AbstractCommandDownload download; - - public AbstractCommandRetriever(String cmdPath, String url, String targetDir){ - this.buildDownload(cmdPath, url, targetDir, null); - } - - public AbstractCommandRetriever(String cmdPath, String url, String targetDir, String[] params){ - this.buildDownload(cmdPath, url, targetDir, params); - } - - protected abstract void buildDownload(String cmdPath, String url, String targetDir, String[] params); - - public void connect() throws DataRetrieveException { - this.download.addObserver(new DefaultStatusObserver(logger)); - this.download.addObserver(new DefaultProgressObserver(logger)); - this.download.addObserver(new DefaultExceptionObserver(logger)); - } - - public void doRetrieve() throws DataRetrieveException { - try { - download.download(); - } catch (IOException e) { - //ignore - } - - if (download.isCompleted()) { - // - } else if (download.isPaused()) { - throw new DataRetrieveException("retry 3 times still have err, paused."); - } else if (download.isAborted()) { - throw new DataRetrieveException("aborted for some configration error."); - } - } - - public void disconnect() { - this.download = null; - } - - public void abort() { - this.download = null; - } - - public void addObserver(Observer o) { - this.download.addObserver(o); - } - - public long getContentLength() throws IOException { - if (download.isCompleted()) { - return download.getAssociatedLocalFile().length(); - } - - return -1; - } - - public byte[] getDataAsByteArray() { - try { - return NioUtils.read(this.getDataAsFile()); - } catch (IOException e) { - throw new DataRetrieveException(e); - } - } - - public File getDataAsFile() { - return download.getAssociatedLocalFile(); - } - - public boolean isDataAvailable() { - return download.isCompleted(); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl; + +import java.io.File; +import java.io.IOException; +import java.util.Observer; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.etl.common.io.download.DataRetriever; +import com.alibaba.otter.node.etl.common.io.download.exception.DataRetrieveException; +import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultExceptionObserver; +import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultProgressObserver; +import com.alibaba.otter.node.etl.common.io.download.impl.observer.DefaultStatusObserver; +import com.alibaba.otter.shared.common.utils.NioUtils; + +/** + * 基于命令行工具的下载 + * + * @author jianghang 2011-10-10 下午05:43:24 + * @version 4.0.0 + */ +public abstract class AbstractCommandRetriever implements DataRetriever { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + protected AbstractCommandDownload download; + + public AbstractCommandRetriever(String cmdPath, String url, String targetDir){ + this.buildDownload(cmdPath, url, targetDir, null); + } + + public AbstractCommandRetriever(String cmdPath, String url, String targetDir, String[] params){ + this.buildDownload(cmdPath, url, targetDir, params); + } + + protected abstract void buildDownload(String cmdPath, String url, String targetDir, String[] params); + + public void connect() throws DataRetrieveException { + this.download.addObserver(new DefaultStatusObserver(logger)); + this.download.addObserver(new DefaultProgressObserver(logger)); + this.download.addObserver(new DefaultExceptionObserver(logger)); + } + + public void doRetrieve() throws DataRetrieveException { + try { + download.download(); + } catch (IOException e) { + //ignore + } + + if (download.isCompleted()) { + // + } else if (download.isPaused()) { + throw new DataRetrieveException("retry 3 times still have err, paused."); + } else if (download.isAborted()) { + throw new DataRetrieveException("aborted for some configration error."); + } + } + + public void disconnect() { + this.download = null; + } + + public void abort() { + this.download = null; + } + + public void addObserver(Observer o) { + this.download.addObserver(o); + } + + public long getContentLength() throws IOException { + if (download.isCompleted()) { + return download.getAssociatedLocalFile().length(); + } + + return -1; + } + + public byte[] getDataAsByteArray() { + try { + return NioUtils.read(this.getDataAsFile()); + } catch (IOException e) { + throw new DataRetrieveException(e); + } + } + + public File getDataAsFile() { + return download.getAssociatedLocalFile(); + } + + public boolean isDataAvailable() { + return download.isCompleted(); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/FileRetriever.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/FileRetriever.java index 75f8b3c2..46d006e0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/FileRetriever.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/FileRetriever.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io.download.impl; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cConfig.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cConfig.java index 60e4a274..dc3d0c0e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cConfig.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cConfig.java @@ -1,44 +1,58 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; - -/** - * @author brave.taoy - */ -public interface Aria2cConfig { - - public static final String[] ARIA2C_PARAM = new String[] { - // 不加载配置文件 - "--no-conf", - - // 每个url下载线程数 1-16 - "-s 16", - - // 最大并发下载数 1-45 - "-j 50", - - // 单机最大连接数 - "-x 16", - - // 每个链接下载的数据大小 - "-k 2M", - - // 连接超时 单位:秒 - "--timeout=600", - - // 最大重试次数 - "--max-tries=5", - - // 停止下载 单位:秒 - "--stop=1800", - - // 覆盖已存在文件 - "--allow-overwrite=true", - - // Set max download speed - // "--max-overall-download-limit=512K", - - // http长连接 - "--enable-http-keep-alive=true", - - // 日志级别 - "--log-level=warn", }; -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; + +/** + * @author brave.taoy + */ +public interface Aria2cConfig { + + public static final String[] ARIA2C_PARAM = new String[] { + // 不加载配置文件 + "--no-conf", + + // 每个url下载线程数 1-16 + "-s 16", + + // 最大并发下载数 1-45 + "-j 50", + + // 单机最大连接数 + "-x 16", + + // 每个链接下载的数据大小 + "-k 2M", + + // 连接超时 单位:秒 + "--timeout=600", + + // 最大重试次数 + "--max-tries=5", + + // 停止下载 单位:秒 + "--stop=1800", + + // 覆盖已存在文件 + "--allow-overwrite=true", + + // Set max download speed + // "--max-overall-download-limit=512K", + + // http长连接 + "--enable-http-keep-alive=true", + + // 日志级别 + "--log-level=warn", }; +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cDownload.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cDownload.java index f25fb071..e150e2e8 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cDownload.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cDownload.java @@ -1,112 +1,126 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; - -import com.alibaba.otter.node.etl.common.io.download.Download; -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; -import com.alibaba.otter.shared.common.utils.cmd.Exec; - -/** - * 文档:http://aria2.sourceforge.net/ - * - * @author jianghang 2011-10-10 下午06:24:11 - * @version 4.0.0 - */ -public class Aria2cDownload extends AbstractCommandDownload implements Aria2cConfig, Download { - - public Aria2cDownload(String cmdPath, String url, String dir){ - super(cmdPath, url, dir, null); - } - - public Aria2cDownload(String cmdPath, String url, String dir, String[] params){ - super(cmdPath, url, dir, params); - } - - @Override - protected void buildCmd(String cmdPath, String[] params) { - // 文件存在时,续传 - boolean retry = targetFile.exists(); - this.cmd = String.format("%s %s-o %s -d %s -l %s/aria2c.log %s %s", cmdPath, retry ? "-c " : "", - targetFile.getName(), this.targetDir, this.targetDir, - StringUtils.join(((params == null) || (params.length == 0)) ? ARIA2C_PARAM : params, - ' '), url); - } - - protected void analyzeResult(Exec.Result result) { - String[] results = StringUtils.split(result.getStdout(), SystemUtils.LINE_SEPARATOR); - List segmentStat = new ArrayList(); - int pos = 0; - - for (; pos < results.length; pos++) { - if (true == results[pos].toLowerCase().startsWith("gid|stat")) { - break; - } - } - - for (pos++; pos < results.length; pos++) { - // 下载结束标志 - // Download Results: - // gid|stat|avg speed |path/URI - // ===+====+===========+=========================================================== - // 1| OK| 103.7KiB/s|./index.html - // - // Status Legend: - // (OK):download completed. - if (true == StringUtils.isNumeric(results[pos].substring(0, 1))) { - - // 分析各个下载块的完成状态 - String[] status = StringUtils.split(results[pos], " \t|"); - - if (status.length > 2) { - if (StringUtils.equalsIgnoreCase(Aria2cStat.OK.name(), status[1])) { - segmentStat.add(Aria2cStat.OK); - } else if (StringUtils.equalsIgnoreCase(Aria2cStat.ERR.name(), status[1])) { - segmentStat.add(Aria2cStat.ERR); - } else if (StringUtils.equalsIgnoreCase(Aria2cStat.INPR.name(), status[1])) { - segmentStat.add(Aria2cStat.INPR); - } - - logger.warn(results[pos]); - } else { - logger.error("it seems aria2 changed it's status format: " + results[pos]); - } - } - } - - int size = segmentStat.size(); - int errCount = 0; - int inprCount = 0; - for (int i = 0; i < size; i++) { - final Aria2cStat stat = segmentStat.get(i); - - if (Aria2cStat.ERR == stat) { - errCount++; - } else if (Aria2cStat.INPR == stat) { - inprCount++; - } - } - - // 如果没有异常,则有可能下载模块全部成功或者部分被异常终止 - if (errCount == 0) { - if (inprCount == 0) { - // 没有异常,表示下载成功 - completed.set(true); - } else { - // 部分被异常终止,可以续传 - paused.set(true); - } - } else { - if (errCount == size) { - // 如果全部下载失败,则存在参数异常 - aborted.set(true); - } else { - // 部分成功,可以续传 - paused.set(true); - } - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.SystemUtils; + +import com.alibaba.otter.node.etl.common.io.download.Download; +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; +import com.alibaba.otter.shared.common.utils.cmd.Exec; + +/** + * 文档:http://aria2.sourceforge.net/ + * + * @author jianghang 2011-10-10 下午06:24:11 + * @version 4.0.0 + */ +public class Aria2cDownload extends AbstractCommandDownload implements Aria2cConfig, Download { + + public Aria2cDownload(String cmdPath, String url, String dir){ + super(cmdPath, url, dir, null); + } + + public Aria2cDownload(String cmdPath, String url, String dir, String[] params){ + super(cmdPath, url, dir, params); + } + + @Override + protected void buildCmd(String cmdPath, String[] params) { + // 文件存在时,续传 + boolean retry = targetFile.exists(); + this.cmd = String.format("%s %s-o %s -d %s -l %s/aria2c.log %s %s", cmdPath, retry ? "-c " : "", + targetFile.getName(), this.targetDir, this.targetDir, + StringUtils.join(((params == null) || (params.length == 0)) ? ARIA2C_PARAM : params, + ' '), url); + } + + protected void analyzeResult(Exec.Result result) { + String[] results = StringUtils.split(result.getStdout(), SystemUtils.LINE_SEPARATOR); + List segmentStat = new ArrayList(); + int pos = 0; + + for (; pos < results.length; pos++) { + if (true == results[pos].toLowerCase().startsWith("gid|stat")) { + break; + } + } + + for (pos++; pos < results.length; pos++) { + // 下载结束标志 + // Download Results: + // gid|stat|avg speed |path/URI + // ===+====+===========+=========================================================== + // 1| OK| 103.7KiB/s|./index.html + // + // Status Legend: + // (OK):download completed. + if (true == StringUtils.isNumeric(results[pos].substring(0, 1))) { + + // 分析各个下载块的完成状态 + String[] status = StringUtils.split(results[pos], " \t|"); + + if (status.length > 2) { + if (StringUtils.equalsIgnoreCase(Aria2cStat.OK.name(), status[1])) { + segmentStat.add(Aria2cStat.OK); + } else if (StringUtils.equalsIgnoreCase(Aria2cStat.ERR.name(), status[1])) { + segmentStat.add(Aria2cStat.ERR); + } else if (StringUtils.equalsIgnoreCase(Aria2cStat.INPR.name(), status[1])) { + segmentStat.add(Aria2cStat.INPR); + } + + logger.warn(results[pos]); + } else { + logger.error("it seems aria2 changed it's status format: " + results[pos]); + } + } + } + + int size = segmentStat.size(); + int errCount = 0; + int inprCount = 0; + for (int i = 0; i < size; i++) { + final Aria2cStat stat = segmentStat.get(i); + + if (Aria2cStat.ERR == stat) { + errCount++; + } else if (Aria2cStat.INPR == stat) { + inprCount++; + } + } + + // 如果没有异常,则有可能下载模块全部成功或者部分被异常终止 + if (errCount == 0) { + if (inprCount == 0) { + // 没有异常,表示下载成功 + completed.set(true); + } else { + // 部分被异常终止,可以续传 + paused.set(true); + } + } else { + if (errCount == size) { + // 如果全部下载失败,则存在参数异常 + aborted.set(true); + } else { + // 部分成功,可以续传 + paused.set(true); + } + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cRetriever.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cRetriever.java index c7316e9c..a4816f57 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cRetriever.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cRetriever.java @@ -1,26 +1,40 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; - -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandRetriever; - -public class Aria2cRetriever extends AbstractCommandRetriever { - - public static final String NAME = "aria2c"; - - public Aria2cRetriever(String url, String targetDir){ - super(NAME, url, targetDir); - } - - public Aria2cRetriever(String cmdPath, String url, String targetDir){ - super(cmdPath, url, targetDir); - } - - public Aria2cRetriever(String cmdPath, String url, String targetDir, String[] params){ - super(cmdPath, url, targetDir, params); - } - - @Override - protected void buildDownload(String cmdPath, String url, String targetDir, String[] params) { - download = new Aria2cDownload(cmdPath, url, targetDir, params); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; + +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandRetriever; + +public class Aria2cRetriever extends AbstractCommandRetriever { + + public static final String NAME = "aria2c"; + + public Aria2cRetriever(String url, String targetDir){ + super(NAME, url, targetDir); + } + + public Aria2cRetriever(String cmdPath, String url, String targetDir){ + super(cmdPath, url, targetDir); + } + + public Aria2cRetriever(String cmdPath, String url, String targetDir, String[] params){ + super(cmdPath, url, targetDir, params); + } + + @Override + protected void buildDownload(String cmdPath, String url, String targetDir, String[] params) { + download = new Aria2cDownload(cmdPath, url, targetDir, params); + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cStat.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cStat.java index 6c28f6a8..61b7bed9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cStat.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/aria2c/Aria2cStat.java @@ -1,15 +1,29 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; - -/** - * Enum description - */ -public enum Aria2cStat { - // 下载成功 - OK, - - // 下载失败 - ERR, - - // 下载进程异常终止 - INPR, -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.aria2c; + +/** + * Enum description + */ +public enum Aria2cStat { + // 下载成功 + OK, + + // 下载失败 + ERR, + + // 下载进程异常终止 + INPR, +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultExceptionObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultExceptionObserver.java index 2689f350..957c752e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultExceptionObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultExceptionObserver.java @@ -1,22 +1,36 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -import org.slf4j.Logger; - -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; - -/** - * @author brave.taoy - */ -public class DefaultExceptionObserver extends ExceptionObserver { - - private Logger logger; - - public DefaultExceptionObserver(Logger logger){ - this.logger = logger; - } - - @Override - public void exceptionOccured(AbstractCommandDownload download, Exception status) { - this.logger.error(status.getMessage(), status); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +import org.slf4j.Logger; + +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; + +/** + * @author brave.taoy + */ +public class DefaultExceptionObserver extends ExceptionObserver { + + private Logger logger; + + public DefaultExceptionObserver(Logger logger){ + this.logger = logger; + } + + @Override + public void exceptionOccured(AbstractCommandDownload download, Exception status) { + this.logger.error(status.getMessage(), status); + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultProgressObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultProgressObserver.java index 5fe3876d..dc1b5750 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultProgressObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultProgressObserver.java @@ -1,21 +1,35 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -import org.slf4j.Logger; - -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; - -public class DefaultProgressObserver extends ProgressObserver { - - private Logger logger; - - public DefaultProgressObserver(Logger logger){ - this.logger = logger; - } - - @Override - public void statusChanged(AbstractCommandDownload download, String msg) { - if (logger.isInfoEnabled()) { - logger.info(msg); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +import org.slf4j.Logger; + +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; + +public class DefaultProgressObserver extends ProgressObserver { + + private Logger logger; + + public DefaultProgressObserver(Logger logger){ + this.logger = logger; + } + + @Override + public void statusChanged(AbstractCommandDownload download, String msg) { + if (logger.isInfoEnabled()) { + logger.info(msg); + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultStatusObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultStatusObserver.java index ac1ec9e8..8c8269dc 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultStatusObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/DefaultStatusObserver.java @@ -1,25 +1,39 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -import org.slf4j.Logger; - -import com.alibaba.otter.node.etl.common.io.download.Download; -import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; - -/** - * @author brave.taoy - */ -public class DefaultStatusObserver extends StatusObserver { - - private Logger logger; - - public DefaultStatusObserver(Logger logger){ - this.logger = logger; - } - - @Override - public void statusChanged(Download download, DownloadStatus status) { - if (logger.isInfoEnabled()) { - logger.info("status: " + status.name()); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +import org.slf4j.Logger; + +import com.alibaba.otter.node.etl.common.io.download.Download; +import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; + +/** + * @author brave.taoy + */ +public class DefaultStatusObserver extends StatusObserver { + + private Logger logger; + + public DefaultStatusObserver(Logger logger){ + this.logger = logger; + } + + @Override + public void statusChanged(Download download, DownloadStatus status) { + if (logger.isInfoEnabled()) { + logger.info("status: " + status.name()); + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ExceptionObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ExceptionObserver.java index 92697615..6e9bf9da 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ExceptionObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ExceptionObserver.java @@ -1,22 +1,36 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -//~--- JDK imports ------------------------------------------------------------ - -import java.util.Observable; -import java.util.Observer; - -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; - -/** - * @author brave.taoy - */ -public abstract class ExceptionObserver implements Observer { - - public abstract void exceptionOccured(AbstractCommandDownload download, Exception status); - - public void update(Observable o, Object arg) { - if (arg instanceof Exception) { - exceptionOccured((AbstractCommandDownload) o, (Exception) arg); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Observable; +import java.util.Observer; + +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; + +/** + * @author brave.taoy + */ +public abstract class ExceptionObserver implements Observer { + + public abstract void exceptionOccured(AbstractCommandDownload download, Exception status); + + public void update(Observable o, Object arg) { + if (arg instanceof Exception) { + exceptionOccured((AbstractCommandDownload) o, (Exception) arg); + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ProgressObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ProgressObserver.java index 5f15595f..7ec7fd77 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ProgressObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/ProgressObserver.java @@ -1,20 +1,34 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -import java.util.Observable; -import java.util.Observer; - -import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; - -/** - * @author brave.taoy - */ -public abstract class ProgressObserver implements Observer { - - public abstract void statusChanged(AbstractCommandDownload download, String status); - - public void update(Observable o, Object arg) { - if (arg instanceof String) { - statusChanged((AbstractCommandDownload) o, (String) arg); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +import java.util.Observable; +import java.util.Observer; + +import com.alibaba.otter.node.etl.common.io.download.impl.AbstractCommandDownload; + +/** + * @author brave.taoy + */ +public abstract class ProgressObserver implements Observer { + + public abstract void statusChanged(AbstractCommandDownload download, String status); + + public void update(Observable o, Object arg) { + if (arg instanceof String) { + statusChanged((AbstractCommandDownload) o, (String) arg); + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/StatusObserver.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/StatusObserver.java index e63b9641..71be4e34 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/StatusObserver.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/download/impl/observer/StatusObserver.java @@ -1,21 +1,35 @@ -package com.alibaba.otter.node.etl.common.io.download.impl.observer; - -import java.util.Observable; -import java.util.Observer; - -import com.alibaba.otter.node.etl.common.io.download.Download; -import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; - -/** - * @author brave.taoy - */ -public abstract class StatusObserver implements Observer { - - public abstract void statusChanged(Download download, DownloadStatus status); - - public void update(Observable o, Object arg) { - if (arg instanceof DownloadStatus) { - statusChanged((Download) o, (DownloadStatus) arg); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.io.download.impl.observer; + +import java.util.Observable; +import java.util.Observer; + +import com.alibaba.otter.node.etl.common.io.download.Download; +import com.alibaba.otter.node.etl.common.io.download.DownloadStatus; + +/** + * @author brave.taoy + */ +public abstract class StatusObserver implements Observer { + + public abstract void statusChanged(Download download, DownloadStatus status); + + public void update(Observable o, Object arg) { + if (arg instanceof DownloadStatus) { + statusChanged((Download) o, (DownloadStatus) arg); + } + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumException.java index 747ee29e..6a1c4c47 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io.signature; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumUtils.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumUtils.java index 7234ddba..51edb4d6 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumUtils.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/ChecksumUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io.signature; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/Crc32C.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/Crc32C.java index 8a688180..0eeb4ee0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/Crc32C.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/io/signature/Crc32C.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + /* * Copyright (C) 2011 the original author or authors. * See the notice.md file distributed with this work for additional diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedServer.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedServer.java index 58aae28f..6d71704b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedServer.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedServer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jetty; import org.eclipse.jetty.server.Connector; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/JmxConnectorServerFactoryBean.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/JmxConnectorServerFactoryBean.java index 4c8e154e..e3afac7f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/JmxConnectorServerFactoryBean.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/JmxConnectorServerFactoryBean.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jmx; import java.io.IOException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregation.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregation.java index ccf7d609..aa7b6d3b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregation.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregation.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jmx; import java.util.concurrent.atomic.AtomicLong; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationCollector.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationCollector.java index a0194ba4..867c3b9f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationCollector.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationCollector.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jmx; import java.util.Map; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/Pipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/Pipe.java index 0033c6ee..50d00250 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/Pipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/Pipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; import com.alibaba.otter.node.etl.common.pipe.exception.PipeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeDataType.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeDataType.java index 7a2eb217..38915c52 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeDataType.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeDataType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeKey.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeKey.java index ad944609..3b99fb32 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeKey.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/PipeKey.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; import java.io.Serializable; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/exception/PipeException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/exception/PipeException.java index 23712816..0800d996 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/exception/PipeException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/exception/PipeException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/RowDataPipeDelegate.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/RowDataPipeDelegate.java index e8fcdd6e..f1689182 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/RowDataPipeDelegate.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/RowDataPipeDelegate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AbstractHttpPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AbstractHttpPipe.java index 0290fb0e..620bc6fa 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AbstractHttpPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AbstractHttpPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AttachmentHttpPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AttachmentHttpPipe.java index 20ff3ce8..13405cb0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AttachmentHttpPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/AttachmentHttpPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/HttpPipeKey.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/HttpPipeKey.java index b7e15abb..870e6833 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/HttpPipeKey.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/HttpPipeKey.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http; import com.alibaba.otter.node.etl.common.pipe.PipeKey; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RemoteUrlBuilder.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RemoteUrlBuilder.java index e0219b59..43fe76e4 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RemoteUrlBuilder.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RemoteUrlBuilder.java @@ -1,63 +1,77 @@ -package com.alibaba.otter.node.etl.common.pipe.impl.http; - -import java.text.MessageFormat; - -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.util.Assert; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.etl.common.pipe.impl.http.archive.ArchiveException; -import com.alibaba.otter.shared.common.model.config.node.Node; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; - -/** - * 远程URL组装实现类 - */ -public class RemoteUrlBuilder implements InitializingBean { - - private int defaultDownloadPort = 8080; - private ConfigClientService configClientService; - private String urlFormat; - - public void afterPropertiesSet() throws Exception { - Assert.notNull(configClientService); - Assert.notNull(urlFormat); - } - - public String getUrl(Long pipelineId, String filePath) { - Node node = configClientService.currentNode(); - Pipeline pipeline = configClientService.findPipeline(pipelineId); - String ip = node.getIp(); - if (pipeline.getParameters().getUseExternalIp()) { - ip = node.getParameters().getExternalIp(); - - if (StringUtils.isEmpty(ip)) { - throw new ArchiveException(String.format("pipelineId:%s useExternalIp by nid[%s] has no external ip", - String.valueOf(pipelineId), String.valueOf(node.getId()))); - } - } - - Integer port = node.getParameters().getDownloadPort();// 注意为其下载端口 - if (port == null || port < 0) { - port = defaultDownloadPort; - } - - return MessageFormat.format(urlFormat, ip, String.valueOf(port), filePath); - } - - // ================= setter / getter ===================== - - public void setDefaultDownloadPort(int defaultDownloadPort) { - this.defaultDownloadPort = defaultDownloadPort; - } - - public void setUrlFormat(String urlFormat) { - this.urlFormat = urlFormat; - } - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.pipe.impl.http; + +import java.text.MessageFormat; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.util.Assert; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.etl.common.pipe.impl.http.archive.ArchiveException; +import com.alibaba.otter.shared.common.model.config.node.Node; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; + +/** + * 远程URL组装实现类 + */ +public class RemoteUrlBuilder implements InitializingBean { + + private int defaultDownloadPort = 8080; + private ConfigClientService configClientService; + private String urlFormat; + + public void afterPropertiesSet() throws Exception { + Assert.notNull(configClientService); + Assert.notNull(urlFormat); + } + + public String getUrl(Long pipelineId, String filePath) { + Node node = configClientService.currentNode(); + Pipeline pipeline = configClientService.findPipeline(pipelineId); + String ip = node.getIp(); + if (pipeline.getParameters().getUseExternalIp()) { + ip = node.getParameters().getExternalIp(); + + if (StringUtils.isEmpty(ip)) { + throw new ArchiveException(String.format("pipelineId:%s useExternalIp by nid[%s] has no external ip", + String.valueOf(pipelineId), String.valueOf(node.getId()))); + } + } + + Integer port = node.getParameters().getDownloadPort();// 注意为其下载端口 + if (port == null || port < 0) { + port = defaultDownloadPort; + } + + return MessageFormat.format(urlFormat, ip, String.valueOf(port), filePath); + } + + // ================= setter / getter ===================== + + public void setDefaultDownloadPort(int defaultDownloadPort) { + this.defaultDownloadPort = defaultDownloadPort; + } + + public void setUrlFormat(String urlFormat) { + this.urlFormat = urlFormat; + } + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RowDataHttpPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RowDataHttpPipe.java index 43511d22..123ec241 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RowDataHttpPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/RowDataHttpPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveBean.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveBean.java index 5a7a0fee..2c6a654f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveBean.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveBean.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http.archive; import java.io.BufferedOutputStream; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveException.java index 81fbf8d4..3e50449f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveException.java @@ -1,48 +1,62 @@ -package com.alibaba.otter.node.etl.common.pipe.impl.http.archive; - -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** - * ArchiveException - */ -public class ArchiveException extends NestableRuntimeException { - - private static final long serialVersionUID = -7288830284122672209L; - - private String errorCode; - private String errorDesc; - - public ArchiveException(String errorCode){ - super(errorCode); - } - - public ArchiveException(String errorCode, Throwable cause){ - super(errorCode, cause); - } - - public ArchiveException(String errorCode, String errorDesc){ - super(errorCode + ":" + errorDesc); - } - - public ArchiveException(String errorCode, String errorDesc, Throwable cause){ - super(errorCode + ":" + errorDesc, cause); - } - - public ArchiveException(Throwable cause){ - super(cause); - } - - public String getErrorCode() { - return errorCode; - } - - public String getErrorDesc() { - return errorDesc; - } - - @Override - public Throwable fillInStackTrace() { - return this; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.pipe.impl.http.archive; + +import org.apache.commons.lang.exception.NestableRuntimeException; + +/** + * ArchiveException + */ +public class ArchiveException extends NestableRuntimeException { + + private static final long serialVersionUID = -7288830284122672209L; + + private String errorCode; + private String errorDesc; + + public ArchiveException(String errorCode){ + super(errorCode); + } + + public ArchiveException(String errorCode, Throwable cause){ + super(errorCode, cause); + } + + public ArchiveException(String errorCode, String errorDesc){ + super(errorCode + ":" + errorDesc); + } + + public ArchiveException(String errorCode, String errorDesc, Throwable cause){ + super(errorCode + ":" + errorDesc, cause); + } + + public ArchiveException(Throwable cause){ + super(cause); + } + + public String getErrorCode() { + return errorCode; + } + + public String getErrorDesc() { + return errorDesc; + } + + @Override + public Throwable fillInStackTrace() { + return this; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveRetriverCallback.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveRetriverCallback.java index 59f6c5fe..8b5c43ef 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveRetriverCallback.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/ArchiveRetriverCallback.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http.archive; import java.io.InputStream; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/LazyFileInputStream.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/LazyFileInputStream.java index 0996a932..c9d407e8 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/LazyFileInputStream.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/http/archive/LazyFileInputStream.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.http.archive; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/AbstractMemoryPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/AbstractMemoryPipe.java index ab434bf3..b2da3ada 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/AbstractMemoryPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/AbstractMemoryPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.memory; import java.util.Map; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/MemoryPipeKey.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/MemoryPipeKey.java index d43c7e24..81744d64 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/MemoryPipeKey.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/MemoryPipeKey.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.memory; import com.alibaba.otter.node.etl.common.pipe.PipeKey; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/RowDataMemoryPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/RowDataMemoryPipe.java index 6830a657..06863a9a 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/RowDataMemoryPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/memory/RowDataMemoryPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.memory; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/AbstractRpcPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/AbstractRpcPipe.java index b469fe8b..c1d41b90 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/AbstractRpcPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/AbstractRpcPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.rpc; import java.util.Map; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RowDataRpcPipe.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RowDataRpcPipe.java index 447ec6b8..d271c976 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RowDataRpcPipe.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RowDataRpcPipe.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.rpc; import com.alibaba.otter.node.common.communication.NodeCommmunicationClient; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RpcPipeKey.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RpcPipeKey.java index 57ef24ce..409105b9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RpcPipeKey.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/pipe/impl/rpc/RpcPipeKey.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe.impl.rpc; import com.alibaba.otter.node.etl.common.pipe.PipeKey; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/task/GlobalTask.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/task/GlobalTask.java index b226abf9..f55dc9a9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/common/task/GlobalTask.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/common/task/GlobalTask.java @@ -1,157 +1,171 @@ -package com.alibaba.otter.node.etl.common.task; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; - -import org.I0Itec.zkclient.exception.ZkInterruptedException; -import org.apache.commons.lang.ClassUtils; -import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.commons.lang.math.RandomUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.etl.common.jmx.StageAggregationCollector; -import com.alibaba.otter.node.etl.common.pipe.impl.RowDataPipeDelegate; -import com.alibaba.otter.shared.arbitrate.ArbitrateEventService; -import com.alibaba.otter.shared.arbitrate.model.TerminEventData; -import com.alibaba.otter.shared.arbitrate.model.TerminEventData.TerminType; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; - -/** - * mainstem,select,extract,transform,load parent Thread. - * - * @author xiaoqing.zhouxq 2011-8-23 上午10:38:14 - */ -public abstract class GlobalTask extends Thread { - - protected final Logger logger = LoggerFactory.getLogger(this.getClass()); - protected volatile boolean running = true; - protected Pipeline pipeline; - protected Long pipelineId; - protected ArbitrateEventService arbitrateEventService; - protected RowDataPipeDelegate rowDataPipeDelegate; - protected ExecutorService executorService; - protected ConfigClientService configClientService; - protected StageAggregationCollector stageAggregationCollector; - protected Map pendingFuture; - - public GlobalTask(Pipeline pipeline){ - this(pipeline.getId()); - this.pipeline = pipeline; - } - - public GlobalTask(Long pipelineId){ - this.pipelineId = pipelineId; - setName(createTaskName(pipelineId, ClassUtils.getShortClassName(this.getClass()))); - pendingFuture = new HashMap(); - } - - public void shutdown() { - running = false; - interrupt(); - - List cancelFutures = new ArrayList(); - for (Map.Entry entry : pendingFuture.entrySet()) { - if (!entry.getValue().isDone()) { - logger.warn("WARN ## Task future processId[{}] canceled!", entry.getKey()); - cancelFutures.add(entry.getValue()); - } - } - - for (Future future : cancelFutures) { - future.cancel(true); - } - pendingFuture.clear(); - } - - protected void sendRollbackTermin(long pipelineId, Throwable exception) { - sendRollbackTermin(pipelineId, ExceptionUtils.getFullStackTrace(exception)); - } - - protected void sendRollbackTermin(long pipelineId, String message) { - TerminEventData errorEventData = new TerminEventData(); - errorEventData.setPipelineId(pipelineId); - errorEventData.setType(TerminType.ROLLBACK); - errorEventData.setCode("setl"); - errorEventData.setDesc(message); - arbitrateEventService.terminEvent().single(errorEventData); - // 每次发送完报警后,sleep一段时间,继续做后面的事 - try { - Thread.sleep(3000 + RandomUtils.nextInt(3000)); - } catch (InterruptedException e) { - } - } - - /** - * 自动处理数据为null的情况,重新发一遍数据 - */ - protected void processMissData(long pipelineId, String message) { - TerminEventData errorEventData = new TerminEventData(); - errorEventData.setPipelineId(pipelineId); - errorEventData.setType(TerminType.RESTART); - errorEventData.setCode("setl"); - errorEventData.setDesc(message); - arbitrateEventService.terminEvent().single(errorEventData); - } - - protected String createTaskName(long pipelineId, String taskName) { - return new StringBuilder().append("pipelineId = ").append(pipelineId).append(",taskName = ").append(taskName).toString(); - } - - protected boolean isProfiling() { - return stageAggregationCollector.isProfiling(); - } - - protected boolean isInterrupt(Throwable e) { - if (!running) { - return true; - } - - if (e instanceof InterruptedException || e instanceof ZkInterruptedException) { - return true; - } - - if (ExceptionUtils.getRootCause(e) instanceof InterruptedException) { - return true; - } - - return false; - - } - - public Collection getPendingProcess() { - List result = new ArrayList(pendingFuture.keySet()); - Collections.sort(result); - return result; - } - - // ====================== setter / getter ========================= - - public void setArbitrateEventService(ArbitrateEventService arbitrateEventService) { - this.arbitrateEventService = arbitrateEventService; - } - - public void setRowDataPipeDelegate(RowDataPipeDelegate rowDataPipeDelegate) { - this.rowDataPipeDelegate = rowDataPipeDelegate; - } - - public void setExecutorService(ExecutorService executorService) { - this.executorService = executorService; - } - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - - public void setStageAggregationCollector(StageAggregationCollector stageAggregationCollector) { - this.stageAggregationCollector = stageAggregationCollector; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.task; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; + +import org.I0Itec.zkclient.exception.ZkInterruptedException; +import org.apache.commons.lang.ClassUtils; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.commons.lang.math.RandomUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.etl.common.jmx.StageAggregationCollector; +import com.alibaba.otter.node.etl.common.pipe.impl.RowDataPipeDelegate; +import com.alibaba.otter.shared.arbitrate.ArbitrateEventService; +import com.alibaba.otter.shared.arbitrate.model.TerminEventData; +import com.alibaba.otter.shared.arbitrate.model.TerminEventData.TerminType; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; + +/** + * mainstem,select,extract,transform,load parent Thread. + * + * @author xiaoqing.zhouxq 2011-8-23 上午10:38:14 + */ +public abstract class GlobalTask extends Thread { + + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); + protected volatile boolean running = true; + protected Pipeline pipeline; + protected Long pipelineId; + protected ArbitrateEventService arbitrateEventService; + protected RowDataPipeDelegate rowDataPipeDelegate; + protected ExecutorService executorService; + protected ConfigClientService configClientService; + protected StageAggregationCollector stageAggregationCollector; + protected Map pendingFuture; + + public GlobalTask(Pipeline pipeline){ + this(pipeline.getId()); + this.pipeline = pipeline; + } + + public GlobalTask(Long pipelineId){ + this.pipelineId = pipelineId; + setName(createTaskName(pipelineId, ClassUtils.getShortClassName(this.getClass()))); + pendingFuture = new HashMap(); + } + + public void shutdown() { + running = false; + interrupt(); + + List cancelFutures = new ArrayList(); + for (Map.Entry entry : pendingFuture.entrySet()) { + if (!entry.getValue().isDone()) { + logger.warn("WARN ## Task future processId[{}] canceled!", entry.getKey()); + cancelFutures.add(entry.getValue()); + } + } + + for (Future future : cancelFutures) { + future.cancel(true); + } + pendingFuture.clear(); + } + + protected void sendRollbackTermin(long pipelineId, Throwable exception) { + sendRollbackTermin(pipelineId, ExceptionUtils.getFullStackTrace(exception)); + } + + protected void sendRollbackTermin(long pipelineId, String message) { + TerminEventData errorEventData = new TerminEventData(); + errorEventData.setPipelineId(pipelineId); + errorEventData.setType(TerminType.ROLLBACK); + errorEventData.setCode("setl"); + errorEventData.setDesc(message); + arbitrateEventService.terminEvent().single(errorEventData); + // 每次发送完报警后,sleep一段时间,继续做后面的事 + try { + Thread.sleep(3000 + RandomUtils.nextInt(3000)); + } catch (InterruptedException e) { + } + } + + /** + * 自动处理数据为null的情况,重新发一遍数据 + */ + protected void processMissData(long pipelineId, String message) { + TerminEventData errorEventData = new TerminEventData(); + errorEventData.setPipelineId(pipelineId); + errorEventData.setType(TerminType.RESTART); + errorEventData.setCode("setl"); + errorEventData.setDesc(message); + arbitrateEventService.terminEvent().single(errorEventData); + } + + protected String createTaskName(long pipelineId, String taskName) { + return new StringBuilder().append("pipelineId = ").append(pipelineId).append(",taskName = ").append(taskName).toString(); + } + + protected boolean isProfiling() { + return stageAggregationCollector.isProfiling(); + } + + protected boolean isInterrupt(Throwable e) { + if (!running) { + return true; + } + + if (e instanceof InterruptedException || e instanceof ZkInterruptedException) { + return true; + } + + if (ExceptionUtils.getRootCause(e) instanceof InterruptedException) { + return true; + } + + return false; + + } + + public Collection getPendingProcess() { + List result = new ArrayList(pendingFuture.keySet()); + Collections.sort(result); + return result; + } + + // ====================== setter / getter ========================= + + public void setArbitrateEventService(ArbitrateEventService arbitrateEventService) { + this.arbitrateEventService = arbitrateEventService; + } + + public void setRowDataPipeDelegate(RowDataPipeDelegate rowDataPipeDelegate) { + this.rowDataPipeDelegate = rowDataPipeDelegate; + } + + public void setExecutorService(ExecutorService executorService) { + this.executorService = executorService; + } + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + + public void setStageAggregationCollector(StageAggregationCollector stageAggregationCollector) { + this.stageAggregationCollector = stageAggregationCollector; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectService.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectService.java index b4319558..778903c8 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectService.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict; import com.alibaba.otter.shared.etl.model.FileBatch; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/exception/ConflictException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/exception/ConflictException.java index 941498ec..f15716da 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/exception/ConflictException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/exception/ConflictException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/impl/FileBatchConflictDetectServiceImpl.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/impl/FileBatchConflictDetectServiceImpl.java index fac98761..44a828e1 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/impl/FileBatchConflictDetectServiceImpl.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/impl/FileBatchConflictDetectServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict.impl; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/ConflictEventType.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/ConflictEventType.java index bfb0e4be..59fab3fc 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/ConflictEventType.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/ConflictEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict.model; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/FileConflictDetectEvent.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/FileConflictDetectEvent.java index 898372b5..ed9c2d5b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/FileConflictDetectEvent.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/conflict/model/FileConflictDetectEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict.model; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/ExtractTask.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/ExtractTask.java index 79941e76..f4d125db 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/ExtractTask.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/ExtractTask.java @@ -1,125 +1,139 @@ -package com.alibaba.otter.node.etl.extract; - -import java.util.List; - -import org.slf4j.MDC; -import org.springframework.util.CollectionUtils; - -import com.alibaba.otter.node.etl.OtterConstants; -import com.alibaba.otter.node.etl.common.jmx.StageAggregation.AggregationItem; -import com.alibaba.otter.node.etl.common.pipe.PipeKey; -import com.alibaba.otter.node.etl.common.task.GlobalTask; -import com.alibaba.otter.node.etl.conflict.FileBatchConflictDetectService; -import com.alibaba.otter.node.etl.extract.extractor.OtterExtractorFactory; -import com.alibaba.otter.shared.arbitrate.model.EtlEventData; -import com.alibaba.otter.shared.common.model.config.enums.StageType; -import com.alibaba.otter.shared.etl.model.DbBatch; -import com.alibaba.otter.shared.etl.model.FileBatch; - -/** - * extract工作线程,负责桥接连接仲裁器 - * - * @author xiaoqing.zhouxq - */ -public class ExtractTask extends GlobalTask { - - private OtterExtractorFactory otterExtractorFactory; - private FileBatchConflictDetectService fileBatchConflictDetectService; - - public ExtractTask(Long pipelineId){ - super(pipelineId); - } - - public void run() { - MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(pipelineId)); - while (running) { - try { - final EtlEventData etlEventData = arbitrateEventService.extractEvent().await(pipelineId); - Runnable task = new Runnable() { - - public void run() { - // 设置profiling信息 - boolean profiling = isProfiling(); - Long profilingStartTime = null; - if (profiling) { - profilingStartTime = System.currentTimeMillis(); - } - - MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(pipelineId)); - String currentName = Thread.currentThread().getName(); - Thread.currentThread().setName(createTaskName(pipelineId, "ExtractWorker")); - try { - pipeline = configClientService.findPipeline(pipelineId); - List keys = (List) etlEventData.getDesc(); - long nextNodeId = etlEventData.getNextNid(); - DbBatch dbBatch = rowDataPipeDelegate.get(keys); - - // 可能拿到为null,因为内存不足或者网络异常,长时间阻塞时,导致从pipe拿数据出现异常,数据可能被上一个节点已经删除 - if (dbBatch == null) { - processMissData(pipelineId, "extract miss data with keys:" + keys.toString()); - return; - } - - otterExtractorFactory.extract(dbBatch);// 重新装配一下数据 - if (dbBatch.getFileBatch() != null - && !CollectionUtils.isEmpty(dbBatch.getFileBatch().getFiles()) - && pipeline.getParameters().getFileDetect()) { // 判断一下是否有文件同步,并且需要进行文件对比 - // 对比一下中美图片是否有变化 - FileBatch fileBatch = fileBatchConflictDetectService.detect(dbBatch.getFileBatch(), - nextNodeId); - dbBatch.setFileBatch(fileBatch); - } - - List pipeKeys = rowDataPipeDelegate.put(dbBatch, nextNodeId); - etlEventData.setDesc(pipeKeys); - - if (profiling) { - Long profilingEndTime = System.currentTimeMillis(); - stageAggregationCollector.push(pipelineId, - StageType.EXTRACT, - new AggregationItem(profilingStartTime, profilingEndTime)); - } - arbitrateEventService.extractEvent().single(etlEventData); - } catch (Throwable e) { - if (!isInterrupt(e)) { - logger.error(String.format("[%d] extractwork executor is error! data:%s", pipelineId, - etlEventData), e); - sendRollbackTermin(pipelineId, e); - } else { - logger.info(String.format("[%d] extractwork executor is interrrupt! data:%s", - pipelineId, etlEventData), e); - } - } finally { - Thread.currentThread().setName(currentName); - MDC.remove(OtterConstants.splitPipelineLogFileKey); - } - } - }; - - // 构造pending任务,可在关闭线程时退出任务 - SetlFuture extractFuture = new SetlFuture(StageType.EXTRACT, etlEventData.getProcessId(), - pendingFuture, task); - executorService.execute(extractFuture); - } catch (Throwable e) { - if (isInterrupt(e)) { - logger.info(String.format("[%s] extractTask is interrupted!", pipelineId), e); - return; - } else { - logger.error(String.format("[%s] extractTask is error!", pipelineId), e); - sendRollbackTermin(pipelineId, e); - } - } - } - } - - // =================== setter / getter ====================== - - public void setOtterExtractorFactory(OtterExtractorFactory otterExtractorFactory) { - this.otterExtractorFactory = otterExtractorFactory; - } - - public void setFileBatchConflictDetectService(FileBatchConflictDetectService fileBatchConflictDetectService) { - this.fileBatchConflictDetectService = fileBatchConflictDetectService; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.extract; + +import java.util.List; + +import org.slf4j.MDC; +import org.springframework.util.CollectionUtils; + +import com.alibaba.otter.node.etl.OtterConstants; +import com.alibaba.otter.node.etl.common.jmx.StageAggregation.AggregationItem; +import com.alibaba.otter.node.etl.common.pipe.PipeKey; +import com.alibaba.otter.node.etl.common.task.GlobalTask; +import com.alibaba.otter.node.etl.conflict.FileBatchConflictDetectService; +import com.alibaba.otter.node.etl.extract.extractor.OtterExtractorFactory; +import com.alibaba.otter.shared.arbitrate.model.EtlEventData; +import com.alibaba.otter.shared.common.model.config.enums.StageType; +import com.alibaba.otter.shared.etl.model.DbBatch; +import com.alibaba.otter.shared.etl.model.FileBatch; + +/** + * extract工作线程,负责桥接连接仲裁器 + * + * @author xiaoqing.zhouxq + */ +public class ExtractTask extends GlobalTask { + + private OtterExtractorFactory otterExtractorFactory; + private FileBatchConflictDetectService fileBatchConflictDetectService; + + public ExtractTask(Long pipelineId){ + super(pipelineId); + } + + public void run() { + MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(pipelineId)); + while (running) { + try { + final EtlEventData etlEventData = arbitrateEventService.extractEvent().await(pipelineId); + Runnable task = new Runnable() { + + public void run() { + // 设置profiling信息 + boolean profiling = isProfiling(); + Long profilingStartTime = null; + if (profiling) { + profilingStartTime = System.currentTimeMillis(); + } + + MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(pipelineId)); + String currentName = Thread.currentThread().getName(); + Thread.currentThread().setName(createTaskName(pipelineId, "ExtractWorker")); + try { + pipeline = configClientService.findPipeline(pipelineId); + List keys = (List) etlEventData.getDesc(); + long nextNodeId = etlEventData.getNextNid(); + DbBatch dbBatch = rowDataPipeDelegate.get(keys); + + // 可能拿到为null,因为内存不足或者网络异常,长时间阻塞时,导致从pipe拿数据出现异常,数据可能被上一个节点已经删除 + if (dbBatch == null) { + processMissData(pipelineId, "extract miss data with keys:" + keys.toString()); + return; + } + + otterExtractorFactory.extract(dbBatch);// 重新装配一下数据 + if (dbBatch.getFileBatch() != null + && !CollectionUtils.isEmpty(dbBatch.getFileBatch().getFiles()) + && pipeline.getParameters().getFileDetect()) { // 判断一下是否有文件同步,并且需要进行文件对比 + // 对比一下中美图片是否有变化 + FileBatch fileBatch = fileBatchConflictDetectService.detect(dbBatch.getFileBatch(), + nextNodeId); + dbBatch.setFileBatch(fileBatch); + } + + List pipeKeys = rowDataPipeDelegate.put(dbBatch, nextNodeId); + etlEventData.setDesc(pipeKeys); + + if (profiling) { + Long profilingEndTime = System.currentTimeMillis(); + stageAggregationCollector.push(pipelineId, + StageType.EXTRACT, + new AggregationItem(profilingStartTime, profilingEndTime)); + } + arbitrateEventService.extractEvent().single(etlEventData); + } catch (Throwable e) { + if (!isInterrupt(e)) { + logger.error(String.format("[%d] extractwork executor is error! data:%s", pipelineId, + etlEventData), e); + sendRollbackTermin(pipelineId, e); + } else { + logger.info(String.format("[%d] extractwork executor is interrrupt! data:%s", + pipelineId, etlEventData), e); + } + } finally { + Thread.currentThread().setName(currentName); + MDC.remove(OtterConstants.splitPipelineLogFileKey); + } + } + }; + + // 构造pending任务,可在关闭线程时退出任务 + SetlFuture extractFuture = new SetlFuture(StageType.EXTRACT, etlEventData.getProcessId(), + pendingFuture, task); + executorService.execute(extractFuture); + } catch (Throwable e) { + if (isInterrupt(e)) { + logger.info(String.format("[%s] extractTask is interrupted!", pipelineId), e); + return; + } else { + logger.error(String.format("[%s] extractTask is error!", pipelineId), e); + sendRollbackTermin(pipelineId, e); + } + } + } + } + + // =================== setter / getter ====================== + + public void setOtterExtractorFactory(OtterExtractorFactory otterExtractorFactory) { + this.otterExtractorFactory = otterExtractorFactory; + } + + public void setFileBatchConflictDetectService(FileBatchConflictDetectService fileBatchConflictDetectService) { + this.fileBatchConflictDetectService = fileBatchConflictDetectService; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/SetlFuture.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/SetlFuture.java index 99b50138..c505d2be 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/SetlFuture.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/SetlFuture.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract; import java.util.Map; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/exceptions/ExtractException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/exceptions/ExtractException.java index e7361133..46b176c1 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/exceptions/ExtractException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/exceptions/ExtractException.java @@ -1,48 +1,62 @@ -package com.alibaba.otter.node.etl.extract.exceptions; - -import org.apache.commons.lang.exception.NestableRuntimeException; - -/** - * ExtractException for extract module. - * - * @author xiaoqing.zhouxq - */ -public class ExtractException extends NestableRuntimeException { - - private static final long serialVersionUID = 2680820522662343759L; - private String errorCode; - private String errorDesc; - - public ExtractException(String errorCode){ - super(errorCode); - } - - public ExtractException(String errorCode, Throwable cause){ - super(errorCode, cause); - } - - public ExtractException(String errorCode, String errorDesc){ - super(errorCode + ":" + errorDesc); - } - - public ExtractException(String errorCode, String errorDesc, Throwable cause){ - super(errorCode + ":" + errorDesc, cause); - } - - public ExtractException(Throwable cause){ - super(cause); - } - - public String getErrorCode() { - return errorCode; - } - - public String getErrorDesc() { - return errorDesc; - } - - @Override - public Throwable fillInStackTrace() { - return this; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.extract.exceptions; + +import org.apache.commons.lang.exception.NestableRuntimeException; + +/** + * ExtractException for extract module. + * + * @author xiaoqing.zhouxq + */ +public class ExtractException extends NestableRuntimeException { + + private static final long serialVersionUID = 2680820522662343759L; + private String errorCode; + private String errorDesc; + + public ExtractException(String errorCode){ + super(errorCode); + } + + public ExtractException(String errorCode, Throwable cause){ + super(errorCode, cause); + } + + public ExtractException(String errorCode, String errorDesc){ + super(errorCode + ":" + errorDesc); + } + + public ExtractException(String errorCode, String errorDesc, Throwable cause){ + super(errorCode + ":" + errorDesc, cause); + } + + public ExtractException(Throwable cause){ + super(cause); + } + + public String getErrorCode() { + return errorCode; + } + + public String getErrorDesc() { + return errorDesc; + } + + @Override + public Throwable fillInStackTrace() { + return this; + } +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/AbstractExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/AbstractExtractor.java index e883b305..ef692262 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/AbstractExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/AbstractExtractor.java @@ -1,41 +1,55 @@ -package com.alibaba.otter.node.etl.extract.extractor; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; -import com.alibaba.otter.shared.common.model.config.ConfigHelper; -import com.alibaba.otter.shared.common.model.config.data.DataMedia; -import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; - -/** - * 单条记录处理的extractor - * - * @author jianghang 2012-4-18 下午04:12:39 - * @version 4.0.2 - */ -public abstract class AbstractExtractor

implements OtterExtractor

{ - - protected ConfigClientService configClientService; - protected DbDialectFactory dbDialectFactory; - - protected DbDialect getDbDialect(Long pipelineId, Long tableId) { - DataMedia dataMedia = ConfigHelper.findDataMedia(getPipeline(pipelineId), tableId); - return dbDialectFactory.getDbDialect(pipelineId, (DbMediaSource) dataMedia.getSource()); - } - - protected Pipeline getPipeline(Long pipelineId) { - return configClientService.findPipeline(pipelineId); - } - - // ==================== setter / getter ===================== - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - - public void setDbDialectFactory(DbDialectFactory dbDialectFactory) { - this.dbDialectFactory = dbDialectFactory; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.extract.extractor; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; +import com.alibaba.otter.shared.common.model.config.ConfigHelper; +import com.alibaba.otter.shared.common.model.config.data.DataMedia; +import com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; + +/** + * 单条记录处理的extractor + * + * @author jianghang 2012-4-18 下午04:12:39 + * @version 4.0.2 + */ +public abstract class AbstractExtractor

implements OtterExtractor

{ + + protected ConfigClientService configClientService; + protected DbDialectFactory dbDialectFactory; + + protected DbDialect getDbDialect(Long pipelineId, Long tableId) { + DataMedia dataMedia = ConfigHelper.findDataMedia(getPipeline(pipelineId), tableId); + return dbDialectFactory.getDbDialect(pipelineId, (DbMediaSource) dataMedia.getSource()); + } + + protected Pipeline getPipeline(Long pipelineId) { + return configClientService.findPipeline(pipelineId); + } + + // ==================== setter / getter ===================== + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + + public void setDbDialectFactory(DbDialectFactory dbDialectFactory) { + this.dbDialectFactory = dbDialectFactory; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/DatabaseExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/DatabaseExtractor.java index 3f67a7eb..c0fa0963 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/DatabaseExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/DatabaseExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.sql.ResultSet; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FileExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FileExtractor.java index 095f9a84..72136b56 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FileExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FileExtractor.java @@ -1,233 +1,247 @@ -package com.alibaba.otter.node.etl.extract.extractor; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.alibaba.otter.node.etl.extract.exceptions.ExtractException; -import com.alibaba.otter.shared.common.model.config.ConfigHelper; -import com.alibaba.otter.shared.common.model.config.data.DataMediaPair; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; -import com.alibaba.otter.shared.common.utils.extension.ExtensionFactory; -import com.alibaba.otter.shared.common.utils.thread.ExecutorTemplate; -import com.alibaba.otter.shared.common.utils.thread.ExecutorTemplateGetter; -import com.alibaba.otter.shared.etl.extend.fileresolver.FileInfo; -import com.alibaba.otter.shared.etl.extend.fileresolver.FileResolver; -import com.alibaba.otter.shared.etl.extend.fileresolver.support.RemoteDirectoryFetcher; -import com.alibaba.otter.shared.etl.extend.fileresolver.support.RemoteDirectoryFetcherAware; -import com.alibaba.otter.shared.etl.model.DbBatch; -import com.alibaba.otter.shared.etl.model.EventColumn; -import com.alibaba.otter.shared.etl.model.EventData; -import com.alibaba.otter.shared.etl.model.EventType; -import com.alibaba.otter.shared.etl.model.FileBatch; -import com.alibaba.otter.shared.etl.model.FileData; -import com.alibaba.otter.shared.etl.model.Identity; -import com.alibaba.otter.shared.etl.model.RowBatch; - -/** - * 基于rowBatch数据,返回对应的关联文件 - * - * @author jianghang 2012-4-18 下午04:52:00 - * @version 4.0.2 - */ -public class FileExtractor extends AbstractExtractor { - - private static final Logger logger = LoggerFactory.getLogger(ExecutorTemplate.class); - private ExtensionFactory extensionFactory; - - private RemoteDirectoryFetcher arandaRemoteDirectoryFetcher; - private int retry = 3; - private ExecutorTemplateGetter executorTemplateGetter; - - public void extract(DbBatch dbBatch) throws ExtractException { - List fileDatas = doFileExtract(dbBatch.getRowBatch()); - FileBatch fileBatch = new FileBatch(); - fileBatch.setFiles(fileDatas); - Identity identity = new Identity(); - identity.setChannelId(dbBatch.getRowBatch().getIdentity().getChannelId()); - identity.setPipelineId(dbBatch.getRowBatch().getIdentity().getPipelineId()); - identity.setProcessId(dbBatch.getRowBatch().getIdentity().getProcessId()); - fileBatch.setIdentity(identity); - dbBatch.setFileBatch(fileBatch); - } - - /** - * 返回这批变更数据对应的FileInfo. - * - * @param rowBatch - * @return - */ - private List doFileExtract(RowBatch rowBatch) { - List fileDatas = new ArrayList(); - // 处理数据 - Pipeline pipeline = getPipeline(rowBatch.getIdentity().getPipelineId()); - List eventDatas = rowBatch.getDatas(); - for (EventData eventData : eventDatas) { - List dataMediaPairs = ConfigHelper.findDataMediaPairByMediaId(pipeline, - eventData.getTableId()); - if (dataMediaPairs == null) { - throw new ExtractException("ERROR ## the dataMediaId = " + eventData.getTableId() - + " dataMediaPair is null,please check"); - } - - for (DataMediaPair dataMediaPair : dataMediaPairs) { - if (dataMediaPair.getResolverData() == null - || dataMediaPair.getResolverData().getExtensionDataType() == null - || (dataMediaPair.getResolverData().getExtensionDataType().isClazz() && StringUtils.isBlank(dataMediaPair.getResolverData().getClazzPath())) - || (dataMediaPair.getResolverData().getExtensionDataType().isSource() && StringUtils.isBlank(dataMediaPair.getResolverData().getSourceText()))) { - continue; - } - - FileResolver fileResolver = null; - - if (dataMediaPair.getResolverData() != null) { - fileResolver = extensionFactory.getExtension(FileResolver.class, dataMediaPair.getResolverData()); - } else { - continue; - } - - if (fileResolver == null) { - throw new ExtractException("ERROR ## the dataMediaId = " + eventData.getTableId() - + " the fileResolver className = " - + dataMediaPair.getResolverData().getClazzPath() - + " is null ,please check the class"); - } - - if (fileResolver instanceof RemoteDirectoryFetcherAware) { - RemoteDirectoryFetcherAware remoteDirectoryFetcherAware = (RemoteDirectoryFetcherAware) fileResolver; - remoteDirectoryFetcherAware.setRemoteDirectoryFetcher(arandaRemoteDirectoryFetcher); - } - - List singleRowFileDatas = getSingleRowFileInfos(dataMediaPair.getId(), fileResolver, - eventData); - // 做一下去重处理 - for (FileData data : singleRowFileDatas) { - if (!fileDatas.contains(data)) { - fileDatas.add(data); - } - } - } - } - - // 判断是否需要进行图片重复同步检查 - if (pipeline.getParameters().getFileDetect()) { - doFileDetectCollector(pipeline, fileDatas); - } - return fileDatas; - } - - private List getSingleRowFileInfos(long pairId, FileResolver fileResolver, EventData eventData) { - if (eventData.getEventType() == EventType.DELETE && fileResolver.isDeleteRequired() == false) { - return new ArrayList(); - } - - Map rowMap = new HashMap(); - - List keyColumns = eventData.getKeys(); - List eventColumns = eventData.getUpdatedColumns(); - for (EventColumn eventColumn : keyColumns) { - rowMap.put(eventColumn.getColumnName().toUpperCase(), eventColumn.getColumnValue()); - } - for (EventColumn eventColumn : eventColumns) { - rowMap.put(eventColumn.getColumnName().toUpperCase(), eventColumn.getColumnValue()); - } - FileInfo[] fileInfos = fileResolver.getFileInfo(rowMap); - if (fileInfos == null || fileInfos.length == 0) { - return new ArrayList(); - } else { - List fileDatas = new ArrayList(); - for (FileInfo fileInfo : fileInfos) { - FileData fileData = new FileData(); - fileData.setPairId(pairId); // 记录一下具体映射规则的id - fileData.setTableId(eventData.getTableId()); - fileData.setEventType(eventData.getEventType()); - fileData.setLastModifiedTime(fileInfo.getLastModifiedTime()); - fileData.setNameSpace(fileInfo.getNamespace()); - fileData.setPath(fileInfo.getPath()); - fileData.setSize(fileInfo.getSize()); - fileDatas.add(fileData); - } - return fileDatas; - } - } - - private void doFileDetectCollector(Pipeline pipeline, List fileDatas) { - ExecutorTemplate executorTemplate = executorTemplateGetter.get(); - try { - executorTemplate.start(); - // 重新设置下poolSize - executorTemplate.adjustPoolSize(pipeline.getParameters().getFileLoadPoolSize()); - for (final FileData fileData : fileDatas) { - // 提交进行多线程处理 - executorTemplate.submit(new Runnable() { - - public void run() { - boolean isAranda = StringUtils.isNotEmpty(fileData.getNameSpace()); - int count = 0; - Throwable exception = null; - while (count++ < retry) { - try { - if (isAranda) { - // remote file - throw new RuntimeException(fileData + " is not support!"); - } else { - // 处理本地文件 - File file = new File(fileData.getPath()); - fileData.setLastModifiedTime(file.lastModified()); - fileData.setSize(file.length()); - } - - return;// 没有异常就退出 - } catch (Exception e) { - fileData.setLastModifiedTime(Long.MIN_VALUE); - fileData.setSize(Long.MIN_VALUE); - exception = e; - } - } - - if (count >= retry) { - logger.warn(String.format("FileDetectCollector is error! collect failed[%s]", - fileData.getNameSpace() + "/" + fileData.getPath()), exception); - } - } - }); - } - - long start = System.currentTimeMillis(); - logger.info("start pipelinep[{}] waitFor FileData Size : {} ", pipeline.getId(), fileDatas.size()); - // 等待所有都处理完成 - executorTemplate.waitForResult(); - logger.info("end pipelinep[{}] waitFor FileData cost : {} ms ", pipeline.getId(), - (System.currentTimeMillis() - start)); - } finally { - if (executorTemplate != null) { - executorTemplateGetter.release(executorTemplate); - } - } - } - - // ==================== setter / getter ===================== - - public void setExtensionFactory(ExtensionFactory extensionFactory) { - this.extensionFactory = extensionFactory; - } - - public void setRetry(int retry) { - this.retry = retry; - } - - public void setArandaRemoteDirectoryFetcher(RemoteDirectoryFetcher arandaRemoteDirectoryFetcher) { - this.arandaRemoteDirectoryFetcher = arandaRemoteDirectoryFetcher; - } - - public void setExecutorTemplateGetter(ExecutorTemplateGetter executorTemplateGetter) { - this.executorTemplateGetter = executorTemplateGetter; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.extract.extractor; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.alibaba.otter.node.etl.extract.exceptions.ExtractException; +import com.alibaba.otter.shared.common.model.config.ConfigHelper; +import com.alibaba.otter.shared.common.model.config.data.DataMediaPair; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; +import com.alibaba.otter.shared.common.utils.extension.ExtensionFactory; +import com.alibaba.otter.shared.common.utils.thread.ExecutorTemplate; +import com.alibaba.otter.shared.common.utils.thread.ExecutorTemplateGetter; +import com.alibaba.otter.shared.etl.extend.fileresolver.FileInfo; +import com.alibaba.otter.shared.etl.extend.fileresolver.FileResolver; +import com.alibaba.otter.shared.etl.extend.fileresolver.support.RemoteDirectoryFetcher; +import com.alibaba.otter.shared.etl.extend.fileresolver.support.RemoteDirectoryFetcherAware; +import com.alibaba.otter.shared.etl.model.DbBatch; +import com.alibaba.otter.shared.etl.model.EventColumn; +import com.alibaba.otter.shared.etl.model.EventData; +import com.alibaba.otter.shared.etl.model.EventType; +import com.alibaba.otter.shared.etl.model.FileBatch; +import com.alibaba.otter.shared.etl.model.FileData; +import com.alibaba.otter.shared.etl.model.Identity; +import com.alibaba.otter.shared.etl.model.RowBatch; + +/** + * 基于rowBatch数据,返回对应的关联文件 + * + * @author jianghang 2012-4-18 下午04:52:00 + * @version 4.0.2 + */ +public class FileExtractor extends AbstractExtractor { + + private static final Logger logger = LoggerFactory.getLogger(ExecutorTemplate.class); + private ExtensionFactory extensionFactory; + + private RemoteDirectoryFetcher arandaRemoteDirectoryFetcher; + private int retry = 3; + private ExecutorTemplateGetter executorTemplateGetter; + + public void extract(DbBatch dbBatch) throws ExtractException { + List fileDatas = doFileExtract(dbBatch.getRowBatch()); + FileBatch fileBatch = new FileBatch(); + fileBatch.setFiles(fileDatas); + Identity identity = new Identity(); + identity.setChannelId(dbBatch.getRowBatch().getIdentity().getChannelId()); + identity.setPipelineId(dbBatch.getRowBatch().getIdentity().getPipelineId()); + identity.setProcessId(dbBatch.getRowBatch().getIdentity().getProcessId()); + fileBatch.setIdentity(identity); + dbBatch.setFileBatch(fileBatch); + } + + /** + * 返回这批变更数据对应的FileInfo. + * + * @param rowBatch + * @return + */ + private List doFileExtract(RowBatch rowBatch) { + List fileDatas = new ArrayList(); + // 处理数据 + Pipeline pipeline = getPipeline(rowBatch.getIdentity().getPipelineId()); + List eventDatas = rowBatch.getDatas(); + for (EventData eventData : eventDatas) { + List dataMediaPairs = ConfigHelper.findDataMediaPairByMediaId(pipeline, + eventData.getTableId()); + if (dataMediaPairs == null) { + throw new ExtractException("ERROR ## the dataMediaId = " + eventData.getTableId() + + " dataMediaPair is null,please check"); + } + + for (DataMediaPair dataMediaPair : dataMediaPairs) { + if (dataMediaPair.getResolverData() == null + || dataMediaPair.getResolverData().getExtensionDataType() == null + || (dataMediaPair.getResolverData().getExtensionDataType().isClazz() && StringUtils.isBlank(dataMediaPair.getResolverData().getClazzPath())) + || (dataMediaPair.getResolverData().getExtensionDataType().isSource() && StringUtils.isBlank(dataMediaPair.getResolverData().getSourceText()))) { + continue; + } + + FileResolver fileResolver = null; + + if (dataMediaPair.getResolverData() != null) { + fileResolver = extensionFactory.getExtension(FileResolver.class, dataMediaPair.getResolverData()); + } else { + continue; + } + + if (fileResolver == null) { + throw new ExtractException("ERROR ## the dataMediaId = " + eventData.getTableId() + + " the fileResolver className = " + + dataMediaPair.getResolverData().getClazzPath() + + " is null ,please check the class"); + } + + if (fileResolver instanceof RemoteDirectoryFetcherAware) { + RemoteDirectoryFetcherAware remoteDirectoryFetcherAware = (RemoteDirectoryFetcherAware) fileResolver; + remoteDirectoryFetcherAware.setRemoteDirectoryFetcher(arandaRemoteDirectoryFetcher); + } + + List singleRowFileDatas = getSingleRowFileInfos(dataMediaPair.getId(), fileResolver, + eventData); + // 做一下去重处理 + for (FileData data : singleRowFileDatas) { + if (!fileDatas.contains(data)) { + fileDatas.add(data); + } + } + } + } + + // 判断是否需要进行图片重复同步检查 + if (pipeline.getParameters().getFileDetect()) { + doFileDetectCollector(pipeline, fileDatas); + } + return fileDatas; + } + + private List getSingleRowFileInfos(long pairId, FileResolver fileResolver, EventData eventData) { + if (eventData.getEventType() == EventType.DELETE && fileResolver.isDeleteRequired() == false) { + return new ArrayList(); + } + + Map rowMap = new HashMap(); + + List keyColumns = eventData.getKeys(); + List eventColumns = eventData.getUpdatedColumns(); + for (EventColumn eventColumn : keyColumns) { + rowMap.put(eventColumn.getColumnName().toUpperCase(), eventColumn.getColumnValue()); + } + for (EventColumn eventColumn : eventColumns) { + rowMap.put(eventColumn.getColumnName().toUpperCase(), eventColumn.getColumnValue()); + } + FileInfo[] fileInfos = fileResolver.getFileInfo(rowMap); + if (fileInfos == null || fileInfos.length == 0) { + return new ArrayList(); + } else { + List fileDatas = new ArrayList(); + for (FileInfo fileInfo : fileInfos) { + FileData fileData = new FileData(); + fileData.setPairId(pairId); // 记录一下具体映射规则的id + fileData.setTableId(eventData.getTableId()); + fileData.setEventType(eventData.getEventType()); + fileData.setLastModifiedTime(fileInfo.getLastModifiedTime()); + fileData.setNameSpace(fileInfo.getNamespace()); + fileData.setPath(fileInfo.getPath()); + fileData.setSize(fileInfo.getSize()); + fileDatas.add(fileData); + } + return fileDatas; + } + } + + private void doFileDetectCollector(Pipeline pipeline, List fileDatas) { + ExecutorTemplate executorTemplate = executorTemplateGetter.get(); + try { + executorTemplate.start(); + // 重新设置下poolSize + executorTemplate.adjustPoolSize(pipeline.getParameters().getFileLoadPoolSize()); + for (final FileData fileData : fileDatas) { + // 提交进行多线程处理 + executorTemplate.submit(new Runnable() { + + public void run() { + boolean isAranda = StringUtils.isNotEmpty(fileData.getNameSpace()); + int count = 0; + Throwable exception = null; + while (count++ < retry) { + try { + if (isAranda) { + // remote file + throw new RuntimeException(fileData + " is not support!"); + } else { + // 处理本地文件 + File file = new File(fileData.getPath()); + fileData.setLastModifiedTime(file.lastModified()); + fileData.setSize(file.length()); + } + + return;// 没有异常就退出 + } catch (Exception e) { + fileData.setLastModifiedTime(Long.MIN_VALUE); + fileData.setSize(Long.MIN_VALUE); + exception = e; + } + } + + if (count >= retry) { + logger.warn(String.format("FileDetectCollector is error! collect failed[%s]", + fileData.getNameSpace() + "/" + fileData.getPath()), exception); + } + } + }); + } + + long start = System.currentTimeMillis(); + logger.info("start pipelinep[{}] waitFor FileData Size : {} ", pipeline.getId(), fileDatas.size()); + // 等待所有都处理完成 + executorTemplate.waitForResult(); + logger.info("end pipelinep[{}] waitFor FileData cost : {} ms ", pipeline.getId(), + (System.currentTimeMillis() - start)); + } finally { + if (executorTemplate != null) { + executorTemplateGetter.release(executorTemplate); + } + } + } + + // ==================== setter / getter ===================== + + public void setExtensionFactory(ExtensionFactory extensionFactory) { + this.extensionFactory = extensionFactory; + } + + public void setRetry(int retry) { + this.retry = retry; + } + + public void setArandaRemoteDirectoryFetcher(RemoteDirectoryFetcher arandaRemoteDirectoryFetcher) { + this.arandaRemoteDirectoryFetcher = arandaRemoteDirectoryFetcher; + } + + public void setExecutorTemplateGetter(ExecutorTemplateGetter executorTemplateGetter) { + this.executorTemplateGetter = executorTemplateGetter; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FreedomExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FreedomExtractor.java index 8600ba2d..1dd1328d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FreedomExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/FreedomExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/GroupExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/GroupExtractor.java index ba4cd8e4..c648be31 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/GroupExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/GroupExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractor.java index 0150ea75..32791086 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractor.java @@ -1,14 +1,28 @@ -package com.alibaba.otter.node.etl.extract.extractor; - -import com.alibaba.otter.node.etl.extract.exceptions.ExtractException; - -/** - * 组装数据,有多种来源,mysql,oracle,store,file等. - */ -public interface OtterExtractor

{ - - /** - * 数据装配 - */ - void extract(P param) throws ExtractException; -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.extract.extractor; + +import com.alibaba.otter.node.etl.extract.exceptions.ExtractException; + +/** + * 组装数据,有多种来源,mysql,oracle,store,file等. + */ +public interface OtterExtractor

{ + + /** + * 数据装配 + */ + void extract(P param) throws ExtractException; +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractorFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractorFactory.java index 3201e5d1..7c6afd6e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractorFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/OtterExtractorFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ProcessorExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ProcessorExtractor.java index 783c7b5a..1fee6089 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ProcessorExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ProcessorExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.util.HashSet; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ViewExtractor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ViewExtractor.java index a06c0d6f..6d86f61d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ViewExtractor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/extract/extractor/ViewExtractor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract.extractor; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/LoadTask.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/LoadTask.java index d055389e..1d7dbca0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/LoadTask.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/LoadTask.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/exception/LoadException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/exception/LoadException.java index 9bcbec7f..9c18b713 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/exception/LoadException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/exception/LoadException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/AbstractLoadContext.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/AbstractLoadContext.java index 21743241..032d077e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/AbstractLoadContext.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/AbstractLoadContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader; import java.io.Serializable; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadContext.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadContext.java index e4439094..a8f0e76b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadContext.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadStatsTracker.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadStatsTracker.java index 8587cc21..06430a70 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadStatsTracker.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/LoadStatsTracker.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader; import java.util.Collection; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoader.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoader.java index a04ef155..e1786a64 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoader.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoader.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoaderFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoaderFactory.java index 460afd49..6d6c0e90 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoaderFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/OtterLoaderFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DataBatchLoader.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DataBatchLoader.java index 11228208..5c3ddb60 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DataBatchLoader.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DataBatchLoader.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.io.File; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java index a2691f4b..91072795 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadAction.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.sql.PreparedStatement; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadData.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadData.java index a7e9b265..baa4b475 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadData.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadDumper.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadDumper.java index c88ac9f5..b1a4bd3f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadDumper.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadDumper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.text.MessageFormat; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadMerger.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadMerger.java index ff6be523..5ca6784d 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadMerger.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/DbLoadMerger.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.io.Serializable; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileLoadAction.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileLoadAction.java index b0fc419c..7a7c916b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileLoadAction.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileLoadAction.java @@ -1,394 +1,408 @@ -package com.alibaba.otter.node.etl.load.loader.db; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorCompletionService; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.etl.OtterConstants; -import com.alibaba.otter.node.etl.load.exception.LoadException; -import com.alibaba.otter.node.etl.load.loader.LoadStatsTracker; -import com.alibaba.otter.node.etl.load.loader.LoadStatsTracker.LoadCounter; -import com.alibaba.otter.node.etl.load.loader.db.context.FileLoadContext; -import com.alibaba.otter.node.etl.load.loader.weight.WeightBuckets; -import com.alibaba.otter.node.etl.load.loader.weight.WeightController; -import com.alibaba.otter.shared.common.model.config.ConfigHelper; -import com.alibaba.otter.shared.common.model.config.channel.Channel; -import com.alibaba.otter.shared.common.model.config.data.DataMediaPair; -import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; -import com.alibaba.otter.shared.common.utils.NioUtils; -import com.alibaba.otter.shared.common.utils.thread.NamedThreadFactory; -import com.alibaba.otter.shared.etl.model.FileBatch; -import com.alibaba.otter.shared.etl.model.FileData; -import com.alibaba.otter.shared.etl.model.Identity; - -/** - * 处理文件load - * - * @author jianghang 2011-10-31 上午11:33:22 - * @author zebinxu 2012-4-28 下午3:39:17 将每个权重的 file load 做成多线程 - * @version 4.0.0 - */ -public class FileLoadAction implements InitializingBean, DisposableBean { - - private static final Logger logger = LoggerFactory.getLogger(FileLoadAction.class); - private int retry = 5; - private ConfigClientService configClientService; - private LoadStatsTracker loadStatsTracker; - private boolean dump = true; - - // for concurrent file load - private static final String WORKER_NAME = "FileLoadAction"; - private static final String WORKER_NAME_FORMAT = "pipelineId = %s , pipelineName = %s , " + WORKER_NAME; - private static final int DEFAULT_POOL_SIZE = 5; - private int poolSize = DEFAULT_POOL_SIZE; - private ExecutorService executor; - - /** - * 返回结果为已处理成功的记录 - */ - public FileLoadContext load(FileBatch fileBatch, File rootDir, WeightController controller) { - if (false == rootDir.exists()) { - throw new LoadException(rootDir.getPath() + " is not exist"); - } - FileLoadContext context = buildContext(fileBatch.getIdentity()); - context.setPrepareDatas(fileBatch.getFiles()); - boolean isDryRun = context.getPipeline().getParameters().isDryRun(); - try { - // 复制成功的文件信息 - WeightBuckets buckets = buildWeightBuckets(fileBatch.getIdentity(), fileBatch.getFiles()); - List weights = buckets.weights(); - controller.start(weights); - // 处理数据 - for (int i = 0; i < weights.size(); i++) { - Long weight = weights.get(i); - controller.await(weight.intValue()); - if (logger.isInfoEnabled()) { - logger.debug("##start load for weight:{}\n", weight); - } - - // 处理同一个weight下的数据 - List items = buckets.getItems(weight); - if (context.getPipeline().getParameters().isDryRun()) { - dryRun(context, items, rootDir); - } else { - moveFiles(context, items, rootDir); - } - - controller.single(weight.intValue()); - if (logger.isInfoEnabled()) { - logger.debug("##end load for weight:{}\n", weight); - } - } - - if (dump || isDryRun) { - MDC.put(OtterConstants.splitPipelineLoadLogFileKey, - String.valueOf(fileBatch.getIdentity().getPipelineId())); - logger.info(FileloadDumper.dumpContext("successed", context)); - MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - if (dump || isDryRun) { - MDC.put(OtterConstants.splitPipelineLoadLogFileKey, - String.valueOf(fileBatch.getIdentity().getPipelineId())); - logger.info(FileloadDumper.dumpContext("error", context)); - MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); - } - } catch (Exception e) { - if (dump || isDryRun) { - MDC.put(OtterConstants.splitPipelineLoadLogFileKey, - String.valueOf(fileBatch.getIdentity().getPipelineId())); - logger.info(FileloadDumper.dumpContext("error", context)); - MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); - } - throw new LoadException(e); - } finally { - - // 不论是否移动成功,删除临时目录 - NioUtils.delete(rootDir, 3); - } - - return context; - } - - private void adjustPoolSize(FileLoadContext context) { - Pipeline pipeline = context.getPipeline(); - int newPoolSize = pipeline.getParameters().getFileLoadPoolSize(); - if (newPoolSize != poolSize) { - poolSize = newPoolSize; - if (executor instanceof ThreadPoolExecutor) { - ThreadPoolExecutor pool = (ThreadPoolExecutor) executor; - pool.setCorePoolSize(newPoolSize); - pool.setMaximumPoolSize(newPoolSize); - } - } - - } - - private FileLoadContext buildContext(Identity identity) { - FileLoadContext context = new FileLoadContext(); - context.setIdentity(identity); - Channel channel = configClientService.findChannel(identity.getChannelId()); - Pipeline pipeline = configClientService.findPipeline(identity.getPipelineId()); - context.setChannel(channel); - context.setPipeline(pipeline); - return context; - } - - /** - * 构建基于weight权重分组的item集合列表 - */ - private WeightBuckets buildWeightBuckets(Identity identity, List datas) { - WeightBuckets buckets = new WeightBuckets(); - for (FileData data : datas) { - // 获取对应的weight - DataMediaPair pair = ConfigHelper.findDataMediaPair(getPipeline(identity), data.getPairId()); - buckets.addItem(pair.getPushWeight(), data); - } - - return buckets; - } - - private Pipeline getPipeline(Identity identity) { - return configClientService.findPipeline(identity.getPipelineId()); - } - - private void dryRun(FileLoadContext context, List fileDatas, File rootDir) { - for (FileData fileData : fileDatas) { - boolean isLocal = StringUtils.isBlank(fileData.getNameSpace()); - String entryName = null; - if (true == isLocal) { - entryName = FilenameUtils.getPath(fileData.getPath()) + FilenameUtils.getName(fileData.getPath()); - } else { - entryName = fileData.getNameSpace() + File.separator + fileData.getPath(); - } - File sourceFile = new File(rootDir, entryName); - if (true == sourceFile.exists() && false == sourceFile.isDirectory()) { - if (false == isLocal) { - throw new LoadException(fileData + " is not support!"); - } else { - // 记录一下文件的meta信息 - fileData.setSize(sourceFile.length()); - fileData.setLastModifiedTime(sourceFile.lastModified()); - context.getProcessedDatas().add(fileData); - } - - LoadCounter counter = loadStatsTracker.getStat(context.getIdentity()).getStat(fileData.getPairId()); - counter.getFileCount().incrementAndGet(); - counter.getFileSize().addAndGet(fileData.getSize()); - } else if (fileData.getEventType().isDelete()) { - // 删除对应的文件 - if (false == isLocal) { - throw new LoadException(fileData + " is not support!"); - } else { - context.getProcessedDatas().add(fileData); - } - } else { - context.getFailedDatas().add(fileData);// 失败记录 - } - } - } - - /** - * 多线程处理文件加载,使用 fast-fail 策略 - */ - private void moveFiles(FileLoadContext context, List fileDatas, File rootDir) { - Exception exception = null; - adjustPoolSize(context); - ExecutorCompletionService executorComplition = new ExecutorCompletionService(executor); - - List> results = new ArrayList>(); - for (FileData fileData : fileDatas) { - Future future = executorComplition.submit(new FileLoadWorker(context, rootDir, fileData)); - results.add(future); - - // fast fail - if (future.isDone()) { // 如果是自己执行的任务(线程池采用 CallerRunsPolicy),则立刻进行检查 - try { - exception = future.get(); - } catch (Exception e) { - exception = e; - } - if (exception != null) { - for (Future result : results) { - if (!result.isDone() && !result.isCancelled()) { - result.cancel(true); - } - } - throw exception instanceof LoadException ? (LoadException) exception : new LoadException(exception); - } - } - - } - - int resultSize = results.size(); - int cursor = 0; - while (cursor < resultSize) { - try { - Future result = executorComplition.take(); - exception = result.get(); - } catch (Exception e) { - exception = e; - break; - } - cursor++; - } - - if (cursor != resultSize) { // 发现任务出错,立刻把正在进行的任务取消 - for (Future future : results) { - if (!future.isDone() && !future.isCancelled()) { - future.cancel(true); - } - } - - } - - if (exception != null) { - throw exception instanceof LoadException ? (LoadException) exception : new LoadException(exception); - } - } - - private class FileLoadWorker implements Callable { - - private FileLoadContext context; - private File rootDir; - private FileData fileData; - - public FileLoadWorker(FileLoadContext context, File rootDir, FileData fileData){ - this.context = context; - this.rootDir = rootDir; - this.fileData = fileData; - - } - - public Exception call() throws Exception { - Thread.currentThread().setName(String.format(WORKER_NAME_FORMAT, context.getPipeline().getId(), - context.getPipeline().getName())); - try { - MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(context.getPipeline().getId())); - if (fileData == null) { - return null; - } - // 进行重试处理 - int count = 0; - Throwable exception = null; - while (count++ < retry) { - try { - doMove(context, rootDir, fileData); - return null; - } catch (Exception e) { - exception = e; - if (count < retry) { - Thread.sleep(50); - } - } - } - - throw new LoadException(String.format("FileLoadWorker is error! createFile failed[%s]", - fileData.getPath()), exception); - } finally { - MDC.remove(OtterConstants.splitPipelineLogFileKey); - } - } - } - - private void doMove(FileLoadContext context, File rootDir, FileData fileData) throws IOException { - boolean isLocal = StringUtils.isBlank(fileData.getNameSpace()); - String entryName = null; - if (true == isLocal) { - entryName = FilenameUtils.getPath(fileData.getPath()) + FilenameUtils.getName(fileData.getPath()); - } else { - entryName = fileData.getNameSpace() + File.separator + fileData.getPath(); - } - File sourceFile = new File(rootDir, entryName); - if (true == sourceFile.exists() && false == sourceFile.isDirectory()) { - if (false == isLocal) { - throw new LoadException(fileData + " is not support!"); - } else { - File targetFile = new File(fileData.getPath()); - // copy to product path - NioUtils.copy(sourceFile, targetFile, retry); - if (true == targetFile.exists()) { - // 记录一下文件的meta信息 - fileData.setSize(sourceFile.length()); - fileData.setLastModifiedTime(sourceFile.lastModified()); - context.getProcessedDatas().add(fileData); - } else { - throw new LoadException(String.format("copy/rename [%s] to [%s] failed by unknow reason", - sourceFile.getPath(), targetFile.getPath())); - } - - } - - LoadCounter counter = loadStatsTracker.getStat(context.getIdentity()).getStat(fileData.getPairId()); - counter.getFileCount().incrementAndGet(); - counter.getFileSize().addAndGet(fileData.getSize()); - } else if (fileData.getEventType().isDelete()) { - // 删除对应的文件 - if (false == isLocal) { - throw new LoadException(fileData + " is not support!"); - } else { - File targetFile = new File(fileData.getPath()); - if (NioUtils.delete(targetFile, retry)) { - context.getProcessedDatas().add(fileData); - } else { - context.getFailedDatas().add(fileData); - } - } - } else { - context.getFailedDatas().add(fileData);// 失败记录 - } - - } - - public void afterPropertiesSet() throws Exception { - executor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS, - new ArrayBlockingQueue(poolSize * 4), - new NamedThreadFactory(WORKER_NAME), - new ThreadPoolExecutor.CallerRunsPolicy()); - } - - public void destroy() throws Exception { - executor.shutdownNow(); - } - - // ====================== setter / getter =========================== - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - - public void setLoadStatsTracker(LoadStatsTracker loadStatsTracker) { - this.loadStatsTracker = loadStatsTracker; - } - - public void setRetry(int retry) { - this.retry = retry; - } - - public void setDump(boolean dump) { - this.dump = dump; - } - - public void setPoolSize(int poolSize) { - this.poolSize = poolSize; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.load.loader.db; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorCompletionService; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.InitializingBean; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.etl.OtterConstants; +import com.alibaba.otter.node.etl.load.exception.LoadException; +import com.alibaba.otter.node.etl.load.loader.LoadStatsTracker; +import com.alibaba.otter.node.etl.load.loader.LoadStatsTracker.LoadCounter; +import com.alibaba.otter.node.etl.load.loader.db.context.FileLoadContext; +import com.alibaba.otter.node.etl.load.loader.weight.WeightBuckets; +import com.alibaba.otter.node.etl.load.loader.weight.WeightController; +import com.alibaba.otter.shared.common.model.config.ConfigHelper; +import com.alibaba.otter.shared.common.model.config.channel.Channel; +import com.alibaba.otter.shared.common.model.config.data.DataMediaPair; +import com.alibaba.otter.shared.common.model.config.pipeline.Pipeline; +import com.alibaba.otter.shared.common.utils.NioUtils; +import com.alibaba.otter.shared.common.utils.thread.NamedThreadFactory; +import com.alibaba.otter.shared.etl.model.FileBatch; +import com.alibaba.otter.shared.etl.model.FileData; +import com.alibaba.otter.shared.etl.model.Identity; + +/** + * 处理文件load + * + * @author jianghang 2011-10-31 上午11:33:22 + * @author zebinxu 2012-4-28 下午3:39:17 将每个权重的 file load 做成多线程 + * @version 4.0.0 + */ +public class FileLoadAction implements InitializingBean, DisposableBean { + + private static final Logger logger = LoggerFactory.getLogger(FileLoadAction.class); + private int retry = 5; + private ConfigClientService configClientService; + private LoadStatsTracker loadStatsTracker; + private boolean dump = true; + + // for concurrent file load + private static final String WORKER_NAME = "FileLoadAction"; + private static final String WORKER_NAME_FORMAT = "pipelineId = %s , pipelineName = %s , " + WORKER_NAME; + private static final int DEFAULT_POOL_SIZE = 5; + private int poolSize = DEFAULT_POOL_SIZE; + private ExecutorService executor; + + /** + * 返回结果为已处理成功的记录 + */ + public FileLoadContext load(FileBatch fileBatch, File rootDir, WeightController controller) { + if (false == rootDir.exists()) { + throw new LoadException(rootDir.getPath() + " is not exist"); + } + FileLoadContext context = buildContext(fileBatch.getIdentity()); + context.setPrepareDatas(fileBatch.getFiles()); + boolean isDryRun = context.getPipeline().getParameters().isDryRun(); + try { + // 复制成功的文件信息 + WeightBuckets buckets = buildWeightBuckets(fileBatch.getIdentity(), fileBatch.getFiles()); + List weights = buckets.weights(); + controller.start(weights); + // 处理数据 + for (int i = 0; i < weights.size(); i++) { + Long weight = weights.get(i); + controller.await(weight.intValue()); + if (logger.isInfoEnabled()) { + logger.debug("##start load for weight:{}\n", weight); + } + + // 处理同一个weight下的数据 + List items = buckets.getItems(weight); + if (context.getPipeline().getParameters().isDryRun()) { + dryRun(context, items, rootDir); + } else { + moveFiles(context, items, rootDir); + } + + controller.single(weight.intValue()); + if (logger.isInfoEnabled()) { + logger.debug("##end load for weight:{}\n", weight); + } + } + + if (dump || isDryRun) { + MDC.put(OtterConstants.splitPipelineLoadLogFileKey, + String.valueOf(fileBatch.getIdentity().getPipelineId())); + logger.info(FileloadDumper.dumpContext("successed", context)); + MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + if (dump || isDryRun) { + MDC.put(OtterConstants.splitPipelineLoadLogFileKey, + String.valueOf(fileBatch.getIdentity().getPipelineId())); + logger.info(FileloadDumper.dumpContext("error", context)); + MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); + } + } catch (Exception e) { + if (dump || isDryRun) { + MDC.put(OtterConstants.splitPipelineLoadLogFileKey, + String.valueOf(fileBatch.getIdentity().getPipelineId())); + logger.info(FileloadDumper.dumpContext("error", context)); + MDC.remove(OtterConstants.splitPipelineLoadLogFileKey); + } + throw new LoadException(e); + } finally { + + // 不论是否移动成功,删除临时目录 + NioUtils.delete(rootDir, 3); + } + + return context; + } + + private void adjustPoolSize(FileLoadContext context) { + Pipeline pipeline = context.getPipeline(); + int newPoolSize = pipeline.getParameters().getFileLoadPoolSize(); + if (newPoolSize != poolSize) { + poolSize = newPoolSize; + if (executor instanceof ThreadPoolExecutor) { + ThreadPoolExecutor pool = (ThreadPoolExecutor) executor; + pool.setCorePoolSize(newPoolSize); + pool.setMaximumPoolSize(newPoolSize); + } + } + + } + + private FileLoadContext buildContext(Identity identity) { + FileLoadContext context = new FileLoadContext(); + context.setIdentity(identity); + Channel channel = configClientService.findChannel(identity.getChannelId()); + Pipeline pipeline = configClientService.findPipeline(identity.getPipelineId()); + context.setChannel(channel); + context.setPipeline(pipeline); + return context; + } + + /** + * 构建基于weight权重分组的item集合列表 + */ + private WeightBuckets buildWeightBuckets(Identity identity, List datas) { + WeightBuckets buckets = new WeightBuckets(); + for (FileData data : datas) { + // 获取对应的weight + DataMediaPair pair = ConfigHelper.findDataMediaPair(getPipeline(identity), data.getPairId()); + buckets.addItem(pair.getPushWeight(), data); + } + + return buckets; + } + + private Pipeline getPipeline(Identity identity) { + return configClientService.findPipeline(identity.getPipelineId()); + } + + private void dryRun(FileLoadContext context, List fileDatas, File rootDir) { + for (FileData fileData : fileDatas) { + boolean isLocal = StringUtils.isBlank(fileData.getNameSpace()); + String entryName = null; + if (true == isLocal) { + entryName = FilenameUtils.getPath(fileData.getPath()) + FilenameUtils.getName(fileData.getPath()); + } else { + entryName = fileData.getNameSpace() + File.separator + fileData.getPath(); + } + File sourceFile = new File(rootDir, entryName); + if (true == sourceFile.exists() && false == sourceFile.isDirectory()) { + if (false == isLocal) { + throw new LoadException(fileData + " is not support!"); + } else { + // 记录一下文件的meta信息 + fileData.setSize(sourceFile.length()); + fileData.setLastModifiedTime(sourceFile.lastModified()); + context.getProcessedDatas().add(fileData); + } + + LoadCounter counter = loadStatsTracker.getStat(context.getIdentity()).getStat(fileData.getPairId()); + counter.getFileCount().incrementAndGet(); + counter.getFileSize().addAndGet(fileData.getSize()); + } else if (fileData.getEventType().isDelete()) { + // 删除对应的文件 + if (false == isLocal) { + throw new LoadException(fileData + " is not support!"); + } else { + context.getProcessedDatas().add(fileData); + } + } else { + context.getFailedDatas().add(fileData);// 失败记录 + } + } + } + + /** + * 多线程处理文件加载,使用 fast-fail 策略 + */ + private void moveFiles(FileLoadContext context, List fileDatas, File rootDir) { + Exception exception = null; + adjustPoolSize(context); + ExecutorCompletionService executorComplition = new ExecutorCompletionService(executor); + + List> results = new ArrayList>(); + for (FileData fileData : fileDatas) { + Future future = executorComplition.submit(new FileLoadWorker(context, rootDir, fileData)); + results.add(future); + + // fast fail + if (future.isDone()) { // 如果是自己执行的任务(线程池采用 CallerRunsPolicy),则立刻进行检查 + try { + exception = future.get(); + } catch (Exception e) { + exception = e; + } + if (exception != null) { + for (Future result : results) { + if (!result.isDone() && !result.isCancelled()) { + result.cancel(true); + } + } + throw exception instanceof LoadException ? (LoadException) exception : new LoadException(exception); + } + } + + } + + int resultSize = results.size(); + int cursor = 0; + while (cursor < resultSize) { + try { + Future result = executorComplition.take(); + exception = result.get(); + } catch (Exception e) { + exception = e; + break; + } + cursor++; + } + + if (cursor != resultSize) { // 发现任务出错,立刻把正在进行的任务取消 + for (Future future : results) { + if (!future.isDone() && !future.isCancelled()) { + future.cancel(true); + } + } + + } + + if (exception != null) { + throw exception instanceof LoadException ? (LoadException) exception : new LoadException(exception); + } + } + + private class FileLoadWorker implements Callable { + + private FileLoadContext context; + private File rootDir; + private FileData fileData; + + public FileLoadWorker(FileLoadContext context, File rootDir, FileData fileData){ + this.context = context; + this.rootDir = rootDir; + this.fileData = fileData; + + } + + public Exception call() throws Exception { + Thread.currentThread().setName(String.format(WORKER_NAME_FORMAT, context.getPipeline().getId(), + context.getPipeline().getName())); + try { + MDC.put(OtterConstants.splitPipelineLogFileKey, String.valueOf(context.getPipeline().getId())); + if (fileData == null) { + return null; + } + // 进行重试处理 + int count = 0; + Throwable exception = null; + while (count++ < retry) { + try { + doMove(context, rootDir, fileData); + return null; + } catch (Exception e) { + exception = e; + if (count < retry) { + Thread.sleep(50); + } + } + } + + throw new LoadException(String.format("FileLoadWorker is error! createFile failed[%s]", + fileData.getPath()), exception); + } finally { + MDC.remove(OtterConstants.splitPipelineLogFileKey); + } + } + } + + private void doMove(FileLoadContext context, File rootDir, FileData fileData) throws IOException { + boolean isLocal = StringUtils.isBlank(fileData.getNameSpace()); + String entryName = null; + if (true == isLocal) { + entryName = FilenameUtils.getPath(fileData.getPath()) + FilenameUtils.getName(fileData.getPath()); + } else { + entryName = fileData.getNameSpace() + File.separator + fileData.getPath(); + } + File sourceFile = new File(rootDir, entryName); + if (true == sourceFile.exists() && false == sourceFile.isDirectory()) { + if (false == isLocal) { + throw new LoadException(fileData + " is not support!"); + } else { + File targetFile = new File(fileData.getPath()); + // copy to product path + NioUtils.copy(sourceFile, targetFile, retry); + if (true == targetFile.exists()) { + // 记录一下文件的meta信息 + fileData.setSize(sourceFile.length()); + fileData.setLastModifiedTime(sourceFile.lastModified()); + context.getProcessedDatas().add(fileData); + } else { + throw new LoadException(String.format("copy/rename [%s] to [%s] failed by unknow reason", + sourceFile.getPath(), targetFile.getPath())); + } + + } + + LoadCounter counter = loadStatsTracker.getStat(context.getIdentity()).getStat(fileData.getPairId()); + counter.getFileCount().incrementAndGet(); + counter.getFileSize().addAndGet(fileData.getSize()); + } else if (fileData.getEventType().isDelete()) { + // 删除对应的文件 + if (false == isLocal) { + throw new LoadException(fileData + " is not support!"); + } else { + File targetFile = new File(fileData.getPath()); + if (NioUtils.delete(targetFile, retry)) { + context.getProcessedDatas().add(fileData); + } else { + context.getFailedDatas().add(fileData); + } + } + } else { + context.getFailedDatas().add(fileData);// 失败记录 + } + + } + + public void afterPropertiesSet() throws Exception { + executor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS, + new ArrayBlockingQueue(poolSize * 4), + new NamedThreadFactory(WORKER_NAME), + new ThreadPoolExecutor.CallerRunsPolicy()); + } + + public void destroy() throws Exception { + executor.shutdownNow(); + } + + // ====================== setter / getter =========================== + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + + public void setLoadStatsTracker(LoadStatsTracker loadStatsTracker) { + this.loadStatsTracker = loadStatsTracker; + } + + public void setRetry(int retry) { + this.retry = retry; + } + + public void setDump(boolean dump) { + this.dump = dump; + } + + public void setPoolSize(int poolSize) { + this.poolSize = poolSize; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileloadDumper.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileloadDumper.java index 78d87707..c4cae9d9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileloadDumper.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/FileloadDumper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db; import java.text.MessageFormat; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/DbLoadContext.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/DbLoadContext.java index 98ea3b80..17dd5b05 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/DbLoadContext.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/DbLoadContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.context; import java.util.Collections; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/FileLoadContext.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/FileLoadContext.java index c3b0bc17..9f7b6597 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/FileLoadContext.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/context/FileLoadContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.context; import com.alibaba.otter.node.etl.load.loader.AbstractLoadContext; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/log/LogLoadInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/log/LogLoadInterceptor.java index 5d3048a9..d19fdc5f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/log/LogLoadInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/log/LogLoadInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.interceptor.log; import java.text.MessageFormat; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/AbstractOperationInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/AbstractOperationInterceptor.java index 005989aa..dada087e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/AbstractOperationInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/AbstractOperationInterceptor.java @@ -1,178 +1,192 @@ -package com.alibaba.otter.node.etl.load.loader.db.interceptor.operation; - -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.text.MessageFormat; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.TransactionCallback; -import org.springframework.transaction.support.TransactionTemplate; - -import com.alibaba.otter.node.common.config.ConfigClientService; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; -import com.alibaba.otter.node.etl.load.loader.db.context.DbLoadContext; -import com.alibaba.otter.node.etl.load.loader.interceptor.AbstractLoadInterceptor; -import com.alibaba.otter.shared.common.model.config.channel.Channel; -import com.alibaba.otter.shared.etl.model.EventData; -import com.alibaba.otter.shared.etl.model.Identity; - -/** - * @author jianghang 2011-10-31 下午02:24:28 - * @version 4.0.0 - */ -public abstract class AbstractOperationInterceptor extends AbstractLoadInterceptor { - - protected final Logger logger = LoggerFactory.getLogger(getClass()); - protected static final int GLOBAL_THREAD_COUNT = 1000; - protected static final int INNER_THREAD_COUNT = 300; - protected static final String checkDataSql = "SELECT COUNT(*) FROM {0} WHERE id BETWEEN 0 AND {1}"; - protected static final String deleteDataSql = "DELETE FROM {0}"; - - protected String updateSql; - protected String updateInfoSql; - protected String clearSql = "UPDATE {0} SET {1} = 0 WHERE id = ? and {1} = ?"; - protected String clearInfoSql = "UPDATE {0} SET {1} = 0 , {2} = null WHERE id = ? and {1} = ? and {2} = ?"; - protected int innerIdCount = INNER_THREAD_COUNT; - protected int globalIdCount = GLOBAL_THREAD_COUNT; - protected ConfigClientService configClientService; - protected Set tableCheckStatus = Collections.synchronizedSet(new HashSet()); - protected AtomicInteger THREAD_COUNTER = new AtomicInteger(0); - protected ThreadLocal threadLocal = new ThreadLocal(); - - protected AbstractOperationInterceptor(String updateSql, String updateInfoSql){ - this.updateSql = updateSql; - this.updateInfoSql = updateInfoSql; - } - - private void init(final JdbcTemplate jdbcTemplate, final String markTableName, final String markTableColumn) { - int count = jdbcTemplate.queryForInt(MessageFormat.format(checkDataSql, markTableName, GLOBAL_THREAD_COUNT - 1)); - if (count != GLOBAL_THREAD_COUNT) { - if (logger.isInfoEnabled()) { - logger.info("Interceptor: init " + markTableName + "'s data."); - } - TransactionTemplate transactionTemplate = new TransactionTemplate(); - transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); - transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);// 注意这里强制使用非事务,保证多线程的可见性 - transactionTemplate.execute(new TransactionCallback() { - - public Object doInTransaction(TransactionStatus status) { - jdbcTemplate.execute(MessageFormat.format(deleteDataSql, markTableName)); - String batchSql = MessageFormat.format(updateSql, new Object[] { markTableName, markTableColumn }); - jdbcTemplate.batchUpdate(batchSql, new BatchPreparedStatementSetter() { - - public void setValues(PreparedStatement ps, int idx) throws SQLException { - ps.setInt(1, idx); - ps.setInt(2, 0); - // ps.setNull(3, Types.VARCHAR); - } - - public int getBatchSize() { - return GLOBAL_THREAD_COUNT; - } - }); - return null; - } - }); - - if (logger.isInfoEnabled()) { - logger.info("Interceptor: Init EROSA Client Data: " + updateSql); - } - } - - } - - public void transactionBegin(DbLoadContext context, List currentDatas, DbDialect dialect) { - boolean needInfo = StringUtils.isNotEmpty(context.getPipeline().getParameters().getChannelInfo()); - if (context.getChannel().getPipelines().size() > 1 || needInfo) {// 如果是双向同步,需要记录clientId - threadLocal.remove();// 进入之前先清理 - int threadId = currentId(); - updateMark(context, dialect, threadId, needInfo ? updateInfoSql : updateSql, needInfo); - threadLocal.set(threadId); - } - } - - public void transactionEnd(DbLoadContext context, List currentDatas, DbDialect dialect) { - boolean needInfo = StringUtils.isNotEmpty(context.getPipeline().getParameters().getChannelInfo()); - if (context.getChannel().getPipelines().size() > 1 || needInfo) {// 如果是双向同步,需要记录clientId - Integer threadId = threadLocal.get(); - updateMark(context, dialect, threadId, needInfo ? clearInfoSql : clearSql, needInfo); - threadLocal.remove(); - } - } - - /** - * 更新一下事务标记 - */ - private void updateMark(DbLoadContext context, DbDialect dialect, int threadId, String sql, boolean needInfo) { - Identity identity = context.getIdentity(); - Channel channel = context.getChannel(); - // 获取dbDialect - String markTableName = context.getPipeline().getParameters().getSystemSchema() + "." - + context.getPipeline().getParameters().getSystemMarkTable(); - String markTableColumn = context.getPipeline().getParameters().getSystemMarkTableColumn(); - synchronized (dialect.getJdbcTemplate()) { - if (tableCheckStatus.contains(dialect.getJdbcTemplate()) == false) { - init(dialect.getJdbcTemplate(), markTableName, markTableColumn); - tableCheckStatus.add(dialect.getJdbcTemplate()); - } - } - - int affectedCount = 0; - if (needInfo) { - String infoColumn = context.getPipeline().getParameters().getSystemMarkTableInfo(); - String info = context.getPipeline().getParameters().getChannelInfo();// 记录一下channelInfo - affectedCount = dialect.getJdbcTemplate().update(MessageFormat.format(sql, new Object[] { markTableName, - markTableColumn, infoColumn }), - new Object[] { threadId, channel.getId(), info }); - } else { - affectedCount = dialect.getJdbcTemplate().update(MessageFormat.format(sql, new Object[] { markTableName, - markTableColumn }), - new Object[] { threadId, channel.getId() }); - } - - if (affectedCount <= 0) { - logger.warn("## update {} failed by [{}]", markTableName, threadId); - } else { - if (logger.isInfoEnabled()) { - logger.debug("Interceptor For [{}]", identity); - } - } - } - - private int currentId() { - synchronized (this) { - if (THREAD_COUNTER.get() == INNER_THREAD_COUNT) { - THREAD_COUNTER.set(0); - } - - return THREAD_COUNTER.incrementAndGet(); - } - } - - // ========================= setter / getter ======================== - - public void setInnerIdCount(int innerIdCount) { - this.innerIdCount = innerIdCount; - } - - public void setGlobalIdCount(int globalIdCount) { - this.globalIdCount = globalIdCount; - } - - public void setConfigClientService(ConfigClientService configClientService) { - this.configClientService = configClientService; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.load.loader.db.interceptor.operation; + +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.BatchPreparedStatementSetter; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionTemplate; + +import com.alibaba.otter.node.common.config.ConfigClientService; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; +import com.alibaba.otter.node.etl.load.loader.db.context.DbLoadContext; +import com.alibaba.otter.node.etl.load.loader.interceptor.AbstractLoadInterceptor; +import com.alibaba.otter.shared.common.model.config.channel.Channel; +import com.alibaba.otter.shared.etl.model.EventData; +import com.alibaba.otter.shared.etl.model.Identity; + +/** + * @author jianghang 2011-10-31 下午02:24:28 + * @version 4.0.0 + */ +public abstract class AbstractOperationInterceptor extends AbstractLoadInterceptor { + + protected final Logger logger = LoggerFactory.getLogger(getClass()); + protected static final int GLOBAL_THREAD_COUNT = 1000; + protected static final int INNER_THREAD_COUNT = 300; + protected static final String checkDataSql = "SELECT COUNT(*) FROM {0} WHERE id BETWEEN 0 AND {1}"; + protected static final String deleteDataSql = "DELETE FROM {0}"; + + protected String updateSql; + protected String updateInfoSql; + protected String clearSql = "UPDATE {0} SET {1} = 0 WHERE id = ? and {1} = ?"; + protected String clearInfoSql = "UPDATE {0} SET {1} = 0 , {2} = null WHERE id = ? and {1} = ? and {2} = ?"; + protected int innerIdCount = INNER_THREAD_COUNT; + protected int globalIdCount = GLOBAL_THREAD_COUNT; + protected ConfigClientService configClientService; + protected Set tableCheckStatus = Collections.synchronizedSet(new HashSet()); + protected AtomicInteger THREAD_COUNTER = new AtomicInteger(0); + protected ThreadLocal threadLocal = new ThreadLocal(); + + protected AbstractOperationInterceptor(String updateSql, String updateInfoSql){ + this.updateSql = updateSql; + this.updateInfoSql = updateInfoSql; + } + + private void init(final JdbcTemplate jdbcTemplate, final String markTableName, final String markTableColumn) { + int count = jdbcTemplate.queryForInt(MessageFormat.format(checkDataSql, markTableName, GLOBAL_THREAD_COUNT - 1)); + if (count != GLOBAL_THREAD_COUNT) { + if (logger.isInfoEnabled()) { + logger.info("Interceptor: init " + markTableName + "'s data."); + } + TransactionTemplate transactionTemplate = new TransactionTemplate(); + transactionTemplate.setTransactionManager(new DataSourceTransactionManager(jdbcTemplate.getDataSource())); + transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);// 注意这里强制使用非事务,保证多线程的可见性 + transactionTemplate.execute(new TransactionCallback() { + + public Object doInTransaction(TransactionStatus status) { + jdbcTemplate.execute(MessageFormat.format(deleteDataSql, markTableName)); + String batchSql = MessageFormat.format(updateSql, new Object[] { markTableName, markTableColumn }); + jdbcTemplate.batchUpdate(batchSql, new BatchPreparedStatementSetter() { + + public void setValues(PreparedStatement ps, int idx) throws SQLException { + ps.setInt(1, idx); + ps.setInt(2, 0); + // ps.setNull(3, Types.VARCHAR); + } + + public int getBatchSize() { + return GLOBAL_THREAD_COUNT; + } + }); + return null; + } + }); + + if (logger.isInfoEnabled()) { + logger.info("Interceptor: Init EROSA Client Data: " + updateSql); + } + } + + } + + public void transactionBegin(DbLoadContext context, List currentDatas, DbDialect dialect) { + boolean needInfo = StringUtils.isNotEmpty(context.getPipeline().getParameters().getChannelInfo()); + if (context.getChannel().getPipelines().size() > 1 || needInfo) {// 如果是双向同步,需要记录clientId + threadLocal.remove();// 进入之前先清理 + int threadId = currentId(); + updateMark(context, dialect, threadId, needInfo ? updateInfoSql : updateSql, needInfo); + threadLocal.set(threadId); + } + } + + public void transactionEnd(DbLoadContext context, List currentDatas, DbDialect dialect) { + boolean needInfo = StringUtils.isNotEmpty(context.getPipeline().getParameters().getChannelInfo()); + if (context.getChannel().getPipelines().size() > 1 || needInfo) {// 如果是双向同步,需要记录clientId + Integer threadId = threadLocal.get(); + updateMark(context, dialect, threadId, needInfo ? clearInfoSql : clearSql, needInfo); + threadLocal.remove(); + } + } + + /** + * 更新一下事务标记 + */ + private void updateMark(DbLoadContext context, DbDialect dialect, int threadId, String sql, boolean needInfo) { + Identity identity = context.getIdentity(); + Channel channel = context.getChannel(); + // 获取dbDialect + String markTableName = context.getPipeline().getParameters().getSystemSchema() + "." + + context.getPipeline().getParameters().getSystemMarkTable(); + String markTableColumn = context.getPipeline().getParameters().getSystemMarkTableColumn(); + synchronized (dialect.getJdbcTemplate()) { + if (tableCheckStatus.contains(dialect.getJdbcTemplate()) == false) { + init(dialect.getJdbcTemplate(), markTableName, markTableColumn); + tableCheckStatus.add(dialect.getJdbcTemplate()); + } + } + + int affectedCount = 0; + if (needInfo) { + String infoColumn = context.getPipeline().getParameters().getSystemMarkTableInfo(); + String info = context.getPipeline().getParameters().getChannelInfo();// 记录一下channelInfo + affectedCount = dialect.getJdbcTemplate().update(MessageFormat.format(sql, new Object[] { markTableName, + markTableColumn, infoColumn }), + new Object[] { threadId, channel.getId(), info }); + } else { + affectedCount = dialect.getJdbcTemplate().update(MessageFormat.format(sql, new Object[] { markTableName, + markTableColumn }), + new Object[] { threadId, channel.getId() }); + } + + if (affectedCount <= 0) { + logger.warn("## update {} failed by [{}]", markTableName, threadId); + } else { + if (logger.isInfoEnabled()) { + logger.debug("Interceptor For [{}]", identity); + } + } + } + + private int currentId() { + synchronized (this) { + if (THREAD_COUNTER.get() == INNER_THREAD_COUNT) { + THREAD_COUNTER.set(0); + } + + return THREAD_COUNTER.incrementAndGet(); + } + } + + // ========================= setter / getter ======================== + + public void setInnerIdCount(int innerIdCount) { + this.innerIdCount = innerIdCount; + } + + public void setGlobalIdCount(int globalIdCount) { + this.globalIdCount = globalIdCount; + } + + public void setConfigClientService(ConfigClientService configClientService) { + this.configClientService = configClientService; + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalMysqlInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalMysqlInterceptor.java index 25c6e60f..898ab0e5 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalMysqlInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalMysqlInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.interceptor.operation; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalOracleInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalOracleInterceptor.java index 9d805f4a..680aafd9 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalOracleInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/CanalOracleInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.interceptor.operation; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/OperationInterceptorFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/OperationInterceptorFactory.java index b1c23eb2..4f409577 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/OperationInterceptorFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/operation/OperationInterceptorFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.interceptor.operation; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/sql/SqlBuilderLoadInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/sql/SqlBuilderLoadInterceptor.java index 6547b83c..f23c5762 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/sql/SqlBuilderLoadInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/db/interceptor/sql/SqlBuilderLoadInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.db.interceptor.sql; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/AbstractLoadInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/AbstractLoadInterceptor.java index 44fca62c..3354e9ce 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/AbstractLoadInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/AbstractLoadInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.interceptor; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/ChainLoadInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/ChainLoadInterceptor.java index 881f32e0..d614aaf4 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/ChainLoadInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/ChainLoadInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.interceptor; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/LoadInterceptor.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/LoadInterceptor.java index e554a42f..a96e46ab 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/LoadInterceptor.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/interceptor/LoadInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.interceptor; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBarrier.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBarrier.java index 90793573..3caef3b4 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBarrier.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBarrier.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.weight; import java.util.concurrent.TimeUnit; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBuckets.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBuckets.java index 2675473d..7c9f04f0 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBuckets.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightBuckets.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.weight; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightController.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightController.java index 17f61294..bcf0b38f 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightController.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/load/loader/weight/WeightController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load.loader.weight; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/model/protobuf/BatchProto.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/model/protobuf/BatchProto.java index eec4d113..c62fa5fc 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/model/protobuf/BatchProto.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/model/protobuf/BatchProto.java @@ -4,5587 +4,5385 @@ package com.alibaba.otter.node.etl.model.protobuf; public final class BatchProto { - - private BatchProto(){ + private BatchProto() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + public interface IdentityOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 channelId = 1; + boolean hasChannelId(); + long getChannelId(); + + // optional int64 pipelineId = 2; + boolean hasPipelineId(); + long getPipelineId(); + + // optional int64 processId = 3; + boolean hasProcessId(); + long getProcessId(); + } + public static final class Identity extends + com.google.protobuf.GeneratedMessage + implements IdentityOrBuilder { + // Use Identity.newBuilder() to construct. + private Identity(Builder builder) { + super(builder); } - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + private Identity(boolean noInit) {} + + private static final Identity defaultInstance; + public static Identity getDefaultInstance() { + return defaultInstance; } - - public interface IdentityOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional int64 channelId = 1; - boolean hasChannelId(); - - long getChannelId(); - - // optional int64 pipelineId = 2; - boolean hasPipelineId(); - - long getPipelineId(); - - // optional int64 processId = 3; - boolean hasProcessId(); - - long getProcessId(); + + public Identity getDefaultInstanceForType() { + return defaultInstance; } - - public static final class Identity extends com.google.protobuf.GeneratedMessage implements IdentityOrBuilder { - - // Use Identity.newBuilder() to construct. - private Identity(Builder builder){ - super(builder); - } - - private Identity(boolean noInit){ - } - - private static final Identity defaultInstance; - - public static Identity getDefaultInstance() { - return defaultInstance; - } - - public Identity getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; - } - - private int bitField0_; - // optional int64 channelId = 1; - public static final int CHANNELID_FIELD_NUMBER = 1; - private long channelId_; - - public boolean hasChannelId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public long getChannelId() { - return channelId_; - } - - // optional int64 pipelineId = 2; - public static final int PIPELINEID_FIELD_NUMBER = 2; - private long pipelineId_; - - public boolean hasPipelineId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public long getPipelineId() { - return pipelineId_; - } - - // optional int64 processId = 3; - public static final int PROCESSID_FIELD_NUMBER = 3; - private long processId_; - - public boolean hasProcessId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public long getProcessId() { - return processId_; - } - - private void initFields() { - channelId_ = 0L; - pipelineId_ = 0L; - processId_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt64(1, channelId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt64(2, pipelineId_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(3, processId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, channelId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, pipelineId_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, processId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - channelId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - pipelineId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000002); - processId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.channelId_ = channelId_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.pipelineId_ = pipelineId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.processId_ = processId_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) return this; - if (other.hasChannelId()) { - setChannelId(other.getChannelId()); - } - if (other.hasPipelineId()) { - setPipelineId(other.getPipelineId()); - } - if (other.hasProcessId()) { - setProcessId(other.getProcessId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - channelId_ = input.readInt64(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - pipelineId_ = input.readInt64(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - processId_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional int64 channelId = 1; - private long channelId_; - - public boolean hasChannelId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public long getChannelId() { - return channelId_; - } - - public Builder setChannelId(long value) { - bitField0_ |= 0x00000001; - channelId_ = value; - onChanged(); - return this; - } - - public Builder clearChannelId() { - bitField0_ = (bitField0_ & ~0x00000001); - channelId_ = 0L; - onChanged(); - return this; - } - - // optional int64 pipelineId = 2; - private long pipelineId_; - - public boolean hasPipelineId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public long getPipelineId() { - return pipelineId_; - } - - public Builder setPipelineId(long value) { - bitField0_ |= 0x00000002; - pipelineId_ = value; - onChanged(); - return this; - } - - public Builder clearPipelineId() { - bitField0_ = (bitField0_ & ~0x00000002); - pipelineId_ = 0L; - onChanged(); - return this; - } - - // optional int64 processId = 3; - private long processId_; - - public boolean hasProcessId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public long getProcessId() { - return processId_; - } - - public Builder setProcessId(long value) { - bitField0_ |= 0x00000004; - processId_ = value; - onChanged(); - return this; - } - - public Builder clearProcessId() { - bitField0_ = (bitField0_ & ~0x00000004); - processId_ = 0L; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.Identity) - } - - static { - defaultInstance = new Identity(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.Identity) + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; } - - public interface RowBatchOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - boolean hasIdentity(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder(); - - // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; - java.util.List getRowsList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index); - - int getRowsCount(); - - java.util.List getRowsOrBuilderList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder(int index); + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; } - - public static final class RowBatch extends com.google.protobuf.GeneratedMessage implements RowBatchOrBuilder { - - // Use RowBatch.newBuilder() to construct. - private RowBatch(Builder builder){ - super(builder); - } - - private RowBatch(boolean noInit){ - } - - private static final RowBatch defaultInstance; - - public static RowBatch getDefaultInstance() { - return defaultInstance; - } - - public RowBatch getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; - } - - private int bitField0_; - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - public static final int IDENTITY_FIELD_NUMBER = 1; - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_; - - public boolean hasIdentity() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { - return identity_; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { - return identity_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; - public static final int ROWS_FIELD_NUMBER = 2; - private java.util.List rows_; - - public java.util.List getRowsList() { - return rows_; - } - - public java.util.List getRowsOrBuilderList() { - return rows_; - } - - public int getRowsCount() { - return rows_.size(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index) { - return rows_.get(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder(int index) { - return rows_.get(index); - } - - private void initFields() { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - rows_ = java.util.Collections.emptyList(); - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, identity_); - } - for (int i = 0; i < rows_.size(); i++) { - output.writeMessage(2, rows_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, identity_); - } - for (int i = 0; i < rows_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, rows_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatchOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getIdentityFieldBuilder(); - getRowsFieldBuilder(); - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (identityBuilder_ == null) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - } else { - identityBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - rowsBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (identityBuilder_ == null) { - result.identity_ = identity_; - } else { - result.identity_ = identityBuilder_.build(); - } - if (rowsBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = java.util.Collections.unmodifiableList(rows_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.rows_ = rows_; - } else { - result.rows_ = rowsBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDefaultInstance()) return this; - if (other.hasIdentity()) { - mergeIdentity(other.getIdentity()); - } - if (rowsBuilder_ == null) { - if (!other.rows_.isEmpty()) { - if (rows_.isEmpty()) { - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureRowsIsMutable(); - rows_.addAll(other.rows_); - } - onChanged(); - } - } else { - if (!other.rows_.isEmpty()) { - if (rowsBuilder_.isEmpty()) { - rowsBuilder_.dispose(); - rowsBuilder_ = null; - rows_ = other.rows_; - bitField0_ = (bitField0_ & ~0x00000002); - rowsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getRowsFieldBuilder() : null; - } else { - rowsBuilder_.addAllMessages(other.rows_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(); - if (hasIdentity()) { - subBuilder.mergeFrom(getIdentity()); - } - input.readMessage(subBuilder, extensionRegistry); - setIdentity(subBuilder.buildPartial()); - break; - } - case 18: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRows(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder identityBuilder_; - - public boolean hasIdentity() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { - if (identityBuilder_ == null) { - return identity_; - } else { - return identityBuilder_.getMessage(); - } - } - - public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { - if (identityBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - identity_ = value; - onChanged(); - } else { - identityBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder builderForValue) { - if (identityBuilder_ == null) { - identity_ = builderForValue.build(); - onChanged(); - } else { - identityBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder mergeIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { - if (identityBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) - && identity_ != com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(identity_).mergeFrom(value).buildPartial(); - } else { - identity_ = value; - } - onChanged(); - } else { - identityBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder clearIdentity() { - if (identityBuilder_ == null) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - onChanged(); - } else { - identityBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder getIdentityBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getIdentityFieldBuilder().getBuilder(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { - if (identityBuilder_ != null) { - return identityBuilder_.getMessageOrBuilder(); - } else { - return identity_; - } - } - - private com.google.protobuf.SingleFieldBuilder getIdentityFieldBuilder() { - if (identityBuilder_ == null) { - identityBuilder_ = new com.google.protobuf.SingleFieldBuilder( - identity_, - getParentForChildren(), - isClean()); - identity_ = null; - } - return identityBuilder_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; - private java.util.List rows_ = java.util.Collections.emptyList(); - - private void ensureRowsIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - rows_ = new java.util.ArrayList(rows_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder rowsBuilder_; - - public java.util.List getRowsList() { - if (rowsBuilder_ == null) { - return java.util.Collections.unmodifiableList(rows_); - } else { - return rowsBuilder_.getMessageList(); - } - } - - public int getRowsCount() { - if (rowsBuilder_ == null) { - return rows_.size(); - } else { - return rowsBuilder_.getCount(); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); - } else { - return rowsBuilder_.getMessage(index); - } - } - - public Builder setRows(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.set(index, value); - onChanged(); - } else { - rowsBuilder_.setMessage(index, value); - } - return this; - } - - public Builder setRows(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.set(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addRows(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(value); - onChanged(); - } else { - rowsBuilder_.addMessage(value); - } - return this; - } - - public Builder addRows(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { - if (rowsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRowsIsMutable(); - rows_.add(index, value); - onChanged(); - } else { - rowsBuilder_.addMessage(index, value); - } - return this; - } - - public Builder addRows(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - public Builder addRows(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.add(index, builderForValue.build()); - onChanged(); - } else { - rowsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addAllRows(java.lang.Iterable values) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - super.addAll(values, rows_); - onChanged(); - } else { - rowsBuilder_.addAllMessages(values); - } - return this; - } - - public Builder clearRows() { - if (rowsBuilder_ == null) { - rows_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - rowsBuilder_.clear(); - } - return this; - } - - public Builder removeRows(int index) { - if (rowsBuilder_ == null) { - ensureRowsIsMutable(); - rows_.remove(index); - onChanged(); - } else { - rowsBuilder_.remove(index); - } - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder getRowsBuilder(int index) { - return getRowsFieldBuilder().getBuilder(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder(int index) { - if (rowsBuilder_ == null) { - return rows_.get(index); - } else { - return rowsBuilder_.getMessageOrBuilder(index); - } - } - - public java.util.List getRowsOrBuilderList() { - if (rowsBuilder_ != null) { - return rowsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(rows_); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder addRowsBuilder() { - return getRowsFieldBuilder().addBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder addRowsBuilder(int index) { - return getRowsFieldBuilder().addBuilder(index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()); - } - - public java.util.List getRowsBuilderList() { - return getRowsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilder getRowsFieldBuilder() { - if (rowsBuilder_ == null) { - rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder( - rows_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - rows_ = null; - } - return rowsBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.RowBatch) - } - - static { - defaultInstance = new RowBatch(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.RowBatch) + + private int bitField0_; + // optional int64 channelId = 1; + public static final int CHANNELID_FIELD_NUMBER = 1; + private long channelId_; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); } - - public interface FileBatchOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - boolean hasIdentity(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder(); - - // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; - java.util.List getFilesList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index); - - int getFilesCount(); - - java.util.List getFilesOrBuilderList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder(int index); + public long getChannelId() { + return channelId_; } - - public static final class FileBatch extends com.google.protobuf.GeneratedMessage implements FileBatchOrBuilder { - - // Use FileBatch.newBuilder() to construct. - private FileBatch(Builder builder){ - super(builder); - } - - private FileBatch(boolean noInit){ - } - - private static final FileBatch defaultInstance; - - public static FileBatch getDefaultInstance() { - return defaultInstance; - } - - public FileBatch getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; - } - - private int bitField0_; - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - public static final int IDENTITY_FIELD_NUMBER = 1; - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_; - - public boolean hasIdentity() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { - return identity_; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { - return identity_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; - public static final int FILES_FIELD_NUMBER = 2; - private java.util.List files_; - - public java.util.List getFilesList() { - return files_; - } - - public java.util.List getFilesOrBuilderList() { - return files_; - } - - public int getFilesCount() { - return files_.size(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index) { - return files_.get(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder(int index) { - return files_.get(index); - } - - private void initFields() { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - files_ = java.util.Collections.emptyList(); - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, identity_); - } - for (int i = 0; i < files_.size(); i++) { - output.writeMessage(2, files_.get(i)); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, identity_); - } - for (int i = 0; i < files_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, files_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatchOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getIdentityFieldBuilder(); - getFilesFieldBuilder(); - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - if (identityBuilder_ == null) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - } else { - identityBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (filesBuilder_ == null) { - files_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - filesBuilder_.clear(); - } - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (identityBuilder_ == null) { - result.identity_ = identity_; - } else { - result.identity_ = identityBuilder_.build(); - } - if (filesBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - files_ = java.util.Collections.unmodifiableList(files_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.files_ = files_; - } else { - result.files_ = filesBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDefaultInstance()) return this; - if (other.hasIdentity()) { - mergeIdentity(other.getIdentity()); - } - if (filesBuilder_ == null) { - if (!other.files_.isEmpty()) { - if (files_.isEmpty()) { - files_ = other.files_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureFilesIsMutable(); - files_.addAll(other.files_); - } - onChanged(); - } - } else { - if (!other.files_.isEmpty()) { - if (filesBuilder_.isEmpty()) { - filesBuilder_.dispose(); - filesBuilder_ = null; - files_ = other.files_; - bitField0_ = (bitField0_ & ~0x00000002); - filesBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getFilesFieldBuilder() : null; - } else { - filesBuilder_.addAllMessages(other.files_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(); - if (hasIdentity()) { - subBuilder.mergeFrom(getIdentity()); - } - input.readMessage(subBuilder, extensionRegistry); - setIdentity(subBuilder.buildPartial()); - break; - } - case 18: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addFiles(subBuilder.buildPartial()); - break; - } - } - } - } - - private int bitField0_; - - // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder identityBuilder_; - - public boolean hasIdentity() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { - if (identityBuilder_ == null) { - return identity_; - } else { - return identityBuilder_.getMessage(); - } - } - - public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { - if (identityBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - identity_ = value; - onChanged(); - } else { - identityBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder builderForValue) { - if (identityBuilder_ == null) { - identity_ = builderForValue.build(); - onChanged(); - } else { - identityBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder mergeIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { - if (identityBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) - && identity_ != com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(identity_).mergeFrom(value).buildPartial(); - } else { - identity_ = value; - } - onChanged(); - } else { - identityBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - - public Builder clearIdentity() { - if (identityBuilder_ == null) { - identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); - onChanged(); - } else { - identityBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder getIdentityBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getIdentityFieldBuilder().getBuilder(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { - if (identityBuilder_ != null) { - return identityBuilder_.getMessageOrBuilder(); - } else { - return identity_; - } - } - - private com.google.protobuf.SingleFieldBuilder getIdentityFieldBuilder() { - if (identityBuilder_ == null) { - identityBuilder_ = new com.google.protobuf.SingleFieldBuilder( - identity_, - getParentForChildren(), - isClean()); - identity_ = null; - } - return identityBuilder_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; - private java.util.List files_ = java.util.Collections.emptyList(); - - private void ensureFilesIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - files_ = new java.util.ArrayList( - files_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilder filesBuilder_; - - public java.util.List getFilesList() { - if (filesBuilder_ == null) { - return java.util.Collections.unmodifiableList(files_); - } else { - return filesBuilder_.getMessageList(); - } - } - - public int getFilesCount() { - if (filesBuilder_ == null) { - return files_.size(); - } else { - return filesBuilder_.getCount(); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index) { - if (filesBuilder_ == null) { - return files_.get(index); - } else { - return filesBuilder_.getMessage(index); - } - } - - public Builder setFiles(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { - if (filesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFilesIsMutable(); - files_.set(index, value); - onChanged(); - } else { - filesBuilder_.setMessage(index, value); - } - return this; - } - - public Builder setFiles(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { - if (filesBuilder_ == null) { - ensureFilesIsMutable(); - files_.set(index, builderForValue.build()); - onChanged(); - } else { - filesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addFiles(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { - if (filesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFilesIsMutable(); - files_.add(value); - onChanged(); - } else { - filesBuilder_.addMessage(value); - } - return this; - } - - public Builder addFiles(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { - if (filesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureFilesIsMutable(); - files_.add(index, value); - onChanged(); - } else { - filesBuilder_.addMessage(index, value); - } - return this; - } - - public Builder addFiles(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { - if (filesBuilder_ == null) { - ensureFilesIsMutable(); - files_.add(builderForValue.build()); - onChanged(); - } else { - filesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - public Builder addFiles(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { - if (filesBuilder_ == null) { - ensureFilesIsMutable(); - files_.add(index, builderForValue.build()); - onChanged(); - } else { - filesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addAllFiles(java.lang.Iterable values) { - if (filesBuilder_ == null) { - ensureFilesIsMutable(); - super.addAll(values, files_); - onChanged(); - } else { - filesBuilder_.addAllMessages(values); - } - return this; - } - - public Builder clearFiles() { - if (filesBuilder_ == null) { - files_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - filesBuilder_.clear(); - } - return this; - } - - public Builder removeFiles(int index) { - if (filesBuilder_ == null) { - ensureFilesIsMutable(); - files_.remove(index); - onChanged(); - } else { - filesBuilder_.remove(index); - } - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder getFilesBuilder(int index) { - return getFilesFieldBuilder().getBuilder(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder(int index) { - if (filesBuilder_ == null) { - return files_.get(index); - } else { - return filesBuilder_.getMessageOrBuilder(index); - } - } - - public java.util.List getFilesOrBuilderList() { - if (filesBuilder_ != null) { - return filesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(files_); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder addFilesBuilder() { - return getFilesFieldBuilder().addBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder addFilesBuilder(int index) { - return getFilesFieldBuilder().addBuilder(index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()); - } - - public java.util.List getFilesBuilderList() { - return getFilesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilder getFilesFieldBuilder() { - if (filesBuilder_ == null) { - filesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder( - files_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - files_ = null; - } - return filesBuilder_; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.FileBatch) - } - - static { - defaultInstance = new FileBatch(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.FileBatch) + + // optional int64 pipelineId = 2; + public static final int PIPELINEID_FIELD_NUMBER = 2; + private long pipelineId_; + public boolean hasPipelineId() { + return ((bitField0_ & 0x00000002) == 0x00000002); } - - public interface RowDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional int64 tableId = 1; - boolean hasTableId(); - - long getTableId(); - - // optional string schemaName = 2; - boolean hasSchemaName(); - - String getSchemaName(); - - // optional string tableName = 3; - boolean hasTableName(); - - String getTableName(); - - // optional string eventType = 4; - boolean hasEventType(); - - String getEventType(); - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; - java.util.List getOldKeysList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index); - - int getOldKeysCount(); - - java.util.List getOldKeysOrBuilderList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder(int index); - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; - java.util.List getKeysList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index); - - int getKeysCount(); - - java.util.List getKeysOrBuilderList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder(int index); - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; - java.util.List getColumnsList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index); - - int getColumnsCount(); - - java.util.List getColumnsOrBuilderList(); - - com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder(int index); - - // optional int64 executeTime = 8; - boolean hasExecuteTime(); - - long getExecuteTime(); - - // optional int64 pairId = 9; - boolean hasPairId(); - - long getPairId(); - - // optional string syncMode = 10; - boolean hasSyncMode(); - - String getSyncMode(); - - // optional string syncConsistency = 11; - boolean hasSyncConsistency(); - - String getSyncConsistency(); - - // optional int64 size = 12; - boolean hasSize(); - - long getSize(); - - // optional bool remedy = 13; - boolean hasRemedy(); - - boolean getRemedy(); + public long getPipelineId() { + return pipelineId_; } - - public static final class RowData extends com.google.protobuf.GeneratedMessage implements RowDataOrBuilder { - - // Use RowData.newBuilder() to construct. - private RowData(Builder builder){ - super(builder); - } - - private RowData(boolean noInit){ - } - - private static final RowData defaultInstance; - - public static RowData getDefaultInstance() { - return defaultInstance; - } - - public RowData getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; - } - - private int bitField0_; - // optional int64 tableId = 1; - public static final int TABLEID_FIELD_NUMBER = 1; - private long tableId_; - - public boolean hasTableId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public long getTableId() { - return tableId_; - } - - // optional string schemaName = 2; - public static final int SCHEMANAME_FIELD_NUMBER = 2; - private java.lang.Object schemaName_; - - public boolean hasSchemaName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getSchemaName() { - java.lang.Object ref = schemaName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - schemaName_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getSchemaNameBytes() { - java.lang.Object ref = schemaName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - schemaName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string tableName = 3; - public static final int TABLENAME_FIELD_NUMBER = 3; - private java.lang.Object tableName_; - - public boolean hasTableName() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getTableName() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - tableName_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getTableNameBytes() { - java.lang.Object ref = tableName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - tableName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string eventType = 4; - public static final int EVENTTYPE_FIELD_NUMBER = 4; - private java.lang.Object eventType_; - - public boolean hasEventType() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public String getEventType() { - java.lang.Object ref = eventType_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - eventType_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getEventTypeBytes() { - java.lang.Object ref = eventType_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - eventType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; - public static final int OLDKEYS_FIELD_NUMBER = 5; - private java.util.List oldKeys_; - - public java.util.List getOldKeysList() { - return oldKeys_; - } - - public java.util.List getOldKeysOrBuilderList() { - return oldKeys_; - } - - public int getOldKeysCount() { - return oldKeys_.size(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index) { - return oldKeys_.get(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder(int index) { - return oldKeys_.get(index); - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; - public static final int KEYS_FIELD_NUMBER = 6; - private java.util.List keys_; - - public java.util.List getKeysList() { - return keys_; - } - - public java.util.List getKeysOrBuilderList() { - return keys_; - } - - public int getKeysCount() { - return keys_.size(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index) { - return keys_.get(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder(int index) { - return keys_.get(index); - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; - public static final int COLUMNS_FIELD_NUMBER = 7; - private java.util.List columns_; - - public java.util.List getColumnsList() { - return columns_; - } - - public java.util.List getColumnsOrBuilderList() { - return columns_; - } - - public int getColumnsCount() { - return columns_.size(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index) { - return columns_.get(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder(int index) { - return columns_.get(index); - } - - // optional int64 executeTime = 8; - public static final int EXECUTETIME_FIELD_NUMBER = 8; - private long executeTime_; - - public boolean hasExecuteTime() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - public long getExecuteTime() { - return executeTime_; - } - - // optional int64 pairId = 9; - public static final int PAIRID_FIELD_NUMBER = 9; - private long pairId_; - - public boolean hasPairId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - public long getPairId() { - return pairId_; - } - - // optional string syncMode = 10; - public static final int SYNCMODE_FIELD_NUMBER = 10; - private java.lang.Object syncMode_; - - public boolean hasSyncMode() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - public String getSyncMode() { - java.lang.Object ref = syncMode_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - syncMode_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getSyncModeBytes() { - java.lang.Object ref = syncMode_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - syncMode_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string syncConsistency = 11; - public static final int SYNCCONSISTENCY_FIELD_NUMBER = 11; - private java.lang.Object syncConsistency_; - - public boolean hasSyncConsistency() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - - public String getSyncConsistency() { - java.lang.Object ref = syncConsistency_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - syncConsistency_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getSyncConsistencyBytes() { - java.lang.Object ref = syncConsistency_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - syncConsistency_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 size = 12; - public static final int SIZE_FIELD_NUMBER = 12; - private long size_; - - public boolean hasSize() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - - public long getSize() { - return size_; - } - - // optional bool remedy = 13; - public static final int REMEDY_FIELD_NUMBER = 13; - private boolean remedy_; - - public boolean hasRemedy() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - - public boolean getRemedy() { - return remedy_; - } - - private void initFields() { - tableId_ = 0L; - schemaName_ = ""; - tableName_ = ""; - eventType_ = ""; - oldKeys_ = java.util.Collections.emptyList(); - keys_ = java.util.Collections.emptyList(); - columns_ = java.util.Collections.emptyList(); - executeTime_ = 0L; - pairId_ = 0L; - syncMode_ = ""; - syncConsistency_ = ""; - size_ = 0L; - remedy_ = false; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt64(1, tableId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getSchemaNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getTableNameBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, getEventTypeBytes()); - } - for (int i = 0; i < oldKeys_.size(); i++) { - output.writeMessage(5, oldKeys_.get(i)); - } - for (int i = 0; i < keys_.size(); i++) { - output.writeMessage(6, keys_.get(i)); - } - for (int i = 0; i < columns_.size(); i++) { - output.writeMessage(7, columns_.get(i)); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt64(8, executeTime_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeInt64(9, pairId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(10, getSyncModeBytes()); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeBytes(11, getSyncConsistencyBytes()); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - output.writeInt64(12, size_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - output.writeBool(13, remedy_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, tableId_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getSchemaNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getTableNameBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, getEventTypeBytes()); - } - for (int i = 0; i < oldKeys_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, oldKeys_.get(i)); - } - for (int i = 0; i < keys_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, keys_.get(i)); - } - for (int i = 0; i < columns_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, columns_.get(i)); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(8, executeTime_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(9, pairId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(10, getSyncModeBytes()); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(11, getSyncConsistencyBytes()); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(12, size_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(13, remedy_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getOldKeysFieldBuilder(); - getKeysFieldBuilder(); - getColumnsFieldBuilder(); - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - tableId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000001); - schemaName_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - tableName_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - eventType_ = ""; - bitField0_ = (bitField0_ & ~0x00000008); - if (oldKeysBuilder_ == null) { - oldKeys_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - oldKeysBuilder_.clear(); - } - if (keysBuilder_ == null) { - keys_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - keysBuilder_.clear(); - } - if (columnsBuilder_ == null) { - columns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - } else { - columnsBuilder_.clear(); - } - executeTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000080); - pairId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000100); - syncMode_ = ""; - bitField0_ = (bitField0_ & ~0x00000200); - syncConsistency_ = ""; - bitField0_ = (bitField0_ & ~0x00000400); - size_ = 0L; - bitField0_ = (bitField0_ & ~0x00000800); - remedy_ = false; - bitField0_ = (bitField0_ & ~0x00001000); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.tableId_ = tableId_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.schemaName_ = schemaName_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.tableName_ = tableName_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.eventType_ = eventType_; - if (oldKeysBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - oldKeys_ = java.util.Collections.unmodifiableList(oldKeys_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.oldKeys_ = oldKeys_; - } else { - result.oldKeys_ = oldKeysBuilder_.build(); - } - if (keysBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - keys_ = java.util.Collections.unmodifiableList(keys_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.keys_ = keys_; - } else { - result.keys_ = keysBuilder_.build(); - } - if (columnsBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040)) { - columns_ = java.util.Collections.unmodifiableList(columns_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.columns_ = columns_; - } else { - result.columns_ = columnsBuilder_.build(); - } - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000010; - } - result.executeTime_ = executeTime_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000020; - } - result.pairId_ = pairId_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000040; - } - result.syncMode_ = syncMode_; - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { - to_bitField0_ |= 0x00000080; - } - result.syncConsistency_ = syncConsistency_; - if (((from_bitField0_ & 0x00000800) == 0x00000800)) { - to_bitField0_ |= 0x00000100; - } - result.size_ = size_; - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { - to_bitField0_ |= 0x00000200; - } - result.remedy_ = remedy_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()) return this; - if (other.hasTableId()) { - setTableId(other.getTableId()); - } - if (other.hasSchemaName()) { - setSchemaName(other.getSchemaName()); - } - if (other.hasTableName()) { - setTableName(other.getTableName()); - } - if (other.hasEventType()) { - setEventType(other.getEventType()); - } - if (oldKeysBuilder_ == null) { - if (!other.oldKeys_.isEmpty()) { - if (oldKeys_.isEmpty()) { - oldKeys_ = other.oldKeys_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureOldKeysIsMutable(); - oldKeys_.addAll(other.oldKeys_); - } - onChanged(); - } - } else { - if (!other.oldKeys_.isEmpty()) { - if (oldKeysBuilder_.isEmpty()) { - oldKeysBuilder_.dispose(); - oldKeysBuilder_ = null; - oldKeys_ = other.oldKeys_; - bitField0_ = (bitField0_ & ~0x00000010); - oldKeysBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getOldKeysFieldBuilder() : null; - } else { - oldKeysBuilder_.addAllMessages(other.oldKeys_); - } - } - } - if (keysBuilder_ == null) { - if (!other.keys_.isEmpty()) { - if (keys_.isEmpty()) { - keys_ = other.keys_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureKeysIsMutable(); - keys_.addAll(other.keys_); - } - onChanged(); - } - } else { - if (!other.keys_.isEmpty()) { - if (keysBuilder_.isEmpty()) { - keysBuilder_.dispose(); - keysBuilder_ = null; - keys_ = other.keys_; - bitField0_ = (bitField0_ & ~0x00000020); - keysBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getKeysFieldBuilder() : null; - } else { - keysBuilder_.addAllMessages(other.keys_); - } - } - } - if (columnsBuilder_ == null) { - if (!other.columns_.isEmpty()) { - if (columns_.isEmpty()) { - columns_ = other.columns_; - bitField0_ = (bitField0_ & ~0x00000040); - } else { - ensureColumnsIsMutable(); - columns_.addAll(other.columns_); - } - onChanged(); - } - } else { - if (!other.columns_.isEmpty()) { - if (columnsBuilder_.isEmpty()) { - columnsBuilder_.dispose(); - columnsBuilder_ = null; - columns_ = other.columns_; - bitField0_ = (bitField0_ & ~0x00000040); - columnsBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getColumnsFieldBuilder() : null; - } else { - columnsBuilder_.addAllMessages(other.columns_); - } - } - } - if (other.hasExecuteTime()) { - setExecuteTime(other.getExecuteTime()); - } - if (other.hasPairId()) { - setPairId(other.getPairId()); - } - if (other.hasSyncMode()) { - setSyncMode(other.getSyncMode()); - } - if (other.hasSyncConsistency()) { - setSyncConsistency(other.getSyncConsistency()); - } - if (other.hasSize()) { - setSize(other.getSize()); - } - if (other.hasRemedy()) { - setRemedy(other.getRemedy()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - tableId_ = input.readInt64(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - schemaName_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - tableName_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - eventType_ = input.readBytes(); - break; - } - case 42: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addOldKeys(subBuilder.buildPartial()); - break; - } - case 50: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addKeys(subBuilder.buildPartial()); - break; - } - case 58: { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addColumns(subBuilder.buildPartial()); - break; - } - case 64: { - bitField0_ |= 0x00000080; - executeTime_ = input.readInt64(); - break; - } - case 72: { - bitField0_ |= 0x00000100; - pairId_ = input.readInt64(); - break; - } - case 82: { - bitField0_ |= 0x00000200; - syncMode_ = input.readBytes(); - break; - } - case 90: { - bitField0_ |= 0x00000400; - syncConsistency_ = input.readBytes(); - break; - } - case 96: { - bitField0_ |= 0x00000800; - size_ = input.readInt64(); - break; - } - case 104: { - bitField0_ |= 0x00001000; - remedy_ = input.readBool(); - break; - } - } - } - } - - private int bitField0_; - - // optional int64 tableId = 1; - private long tableId_; - - public boolean hasTableId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public long getTableId() { - return tableId_; - } - - public Builder setTableId(long value) { - bitField0_ |= 0x00000001; - tableId_ = value; - onChanged(); - return this; - } - - public Builder clearTableId() { - bitField0_ = (bitField0_ & ~0x00000001); - tableId_ = 0L; - onChanged(); - return this; - } - - // optional string schemaName = 2; - private java.lang.Object schemaName_ = ""; - - public boolean hasSchemaName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getSchemaName() { - java.lang.Object ref = schemaName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - schemaName_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setSchemaName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - schemaName_ = value; - onChanged(); - return this; - } - - public Builder clearSchemaName() { - bitField0_ = (bitField0_ & ~0x00000002); - schemaName_ = getDefaultInstance().getSchemaName(); - onChanged(); - return this; - } - - void setSchemaName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - schemaName_ = value; - onChanged(); - } - - // optional string tableName = 3; - private java.lang.Object tableName_ = ""; - - public boolean hasTableName() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getTableName() { - java.lang.Object ref = tableName_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - tableName_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setTableName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - tableName_ = value; - onChanged(); - return this; - } - - public Builder clearTableName() { - bitField0_ = (bitField0_ & ~0x00000004); - tableName_ = getDefaultInstance().getTableName(); - onChanged(); - return this; - } - - void setTableName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; - tableName_ = value; - onChanged(); - } - - // optional string eventType = 4; - private java.lang.Object eventType_ = ""; - - public boolean hasEventType() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public String getEventType() { - java.lang.Object ref = eventType_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - eventType_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setEventType(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - eventType_ = value; - onChanged(); - return this; - } - - public Builder clearEventType() { - bitField0_ = (bitField0_ & ~0x00000008); - eventType_ = getDefaultInstance().getEventType(); - onChanged(); - return this; - } - - void setEventType(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000008; - eventType_ = value; - onChanged(); - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; - private java.util.List oldKeys_ = java.util.Collections.emptyList(); - - private void ensureOldKeysIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - oldKeys_ = new java.util.ArrayList( - oldKeys_); - bitField0_ |= 0x00000010; - } - } - - private com.google.protobuf.RepeatedFieldBuilder oldKeysBuilder_; - - public java.util.List getOldKeysList() { - if (oldKeysBuilder_ == null) { - return java.util.Collections.unmodifiableList(oldKeys_); - } else { - return oldKeysBuilder_.getMessageList(); - } - } - - public int getOldKeysCount() { - if (oldKeysBuilder_ == null) { - return oldKeys_.size(); - } else { - return oldKeysBuilder_.getCount(); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index) { - if (oldKeysBuilder_ == null) { - return oldKeys_.get(index); - } else { - return oldKeysBuilder_.getMessage(index); - } - } - - public Builder setOldKeys(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (oldKeysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureOldKeysIsMutable(); - oldKeys_.set(index, value); - onChanged(); - } else { - oldKeysBuilder_.setMessage(index, value); - } - return this; - } - - public Builder setOldKeys(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (oldKeysBuilder_ == null) { - ensureOldKeysIsMutable(); - oldKeys_.set(index, builderForValue.build()); - onChanged(); - } else { - oldKeysBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addOldKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (oldKeysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureOldKeysIsMutable(); - oldKeys_.add(value); - onChanged(); - } else { - oldKeysBuilder_.addMessage(value); - } - return this; - } - - public Builder addOldKeys(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (oldKeysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureOldKeysIsMutable(); - oldKeys_.add(index, value); - onChanged(); - } else { - oldKeysBuilder_.addMessage(index, value); - } - return this; - } - - public Builder addOldKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (oldKeysBuilder_ == null) { - ensureOldKeysIsMutable(); - oldKeys_.add(builderForValue.build()); - onChanged(); - } else { - oldKeysBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - public Builder addOldKeys(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (oldKeysBuilder_ == null) { - ensureOldKeysIsMutable(); - oldKeys_.add(index, builderForValue.build()); - onChanged(); - } else { - oldKeysBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addAllOldKeys(java.lang.Iterable values) { - if (oldKeysBuilder_ == null) { - ensureOldKeysIsMutable(); - super.addAll(values, oldKeys_); - onChanged(); - } else { - oldKeysBuilder_.addAllMessages(values); - } - return this; - } - - public Builder clearOldKeys() { - if (oldKeysBuilder_ == null) { - oldKeys_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - oldKeysBuilder_.clear(); - } - return this; - } - - public Builder removeOldKeys(int index) { - if (oldKeysBuilder_ == null) { - ensureOldKeysIsMutable(); - oldKeys_.remove(index); - onChanged(); - } else { - oldKeysBuilder_.remove(index); - } - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getOldKeysBuilder(int index) { - return getOldKeysFieldBuilder().getBuilder(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder(int index) { - if (oldKeysBuilder_ == null) { - return oldKeys_.get(index); - } else { - return oldKeysBuilder_.getMessageOrBuilder(index); - } - } - - public java.util.List getOldKeysOrBuilderList() { - if (oldKeysBuilder_ != null) { - return oldKeysBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(oldKeys_); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addOldKeysBuilder() { - return getOldKeysFieldBuilder().addBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addOldKeysBuilder(int index) { - return getOldKeysFieldBuilder().addBuilder(index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public java.util.List getOldKeysBuilderList() { - return getOldKeysFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilder getOldKeysFieldBuilder() { - if (oldKeysBuilder_ == null) { - oldKeysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder( - oldKeys_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - oldKeys_ = null; - } - return oldKeysBuilder_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; - private java.util.List keys_ = java.util.Collections.emptyList(); - - private void ensureKeysIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - keys_ = new java.util.ArrayList(keys_); - bitField0_ |= 0x00000020; - } - } - - private com.google.protobuf.RepeatedFieldBuilder keysBuilder_; - - public java.util.List getKeysList() { - if (keysBuilder_ == null) { - return java.util.Collections.unmodifiableList(keys_); - } else { - return keysBuilder_.getMessageList(); - } - } - - public int getKeysCount() { - if (keysBuilder_ == null) { - return keys_.size(); - } else { - return keysBuilder_.getCount(); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index) { - if (keysBuilder_ == null) { - return keys_.get(index); - } else { - return keysBuilder_.getMessage(index); - } - } - - public Builder setKeys(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (keysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureKeysIsMutable(); - keys_.set(index, value); - onChanged(); - } else { - keysBuilder_.setMessage(index, value); - } - return this; - } - - public Builder setKeys(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (keysBuilder_ == null) { - ensureKeysIsMutable(); - keys_.set(index, builderForValue.build()); - onChanged(); - } else { - keysBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (keysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureKeysIsMutable(); - keys_.add(value); - onChanged(); - } else { - keysBuilder_.addMessage(value); - } - return this; - } - - public Builder addKeys(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (keysBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureKeysIsMutable(); - keys_.add(index, value); - onChanged(); - } else { - keysBuilder_.addMessage(index, value); - } - return this; - } - - public Builder addKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (keysBuilder_ == null) { - ensureKeysIsMutable(); - keys_.add(builderForValue.build()); - onChanged(); - } else { - keysBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - public Builder addKeys(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (keysBuilder_ == null) { - ensureKeysIsMutable(); - keys_.add(index, builderForValue.build()); - onChanged(); - } else { - keysBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addAllKeys(java.lang.Iterable values) { - if (keysBuilder_ == null) { - ensureKeysIsMutable(); - super.addAll(values, keys_); - onChanged(); - } else { - keysBuilder_.addAllMessages(values); - } - return this; - } - - public Builder clearKeys() { - if (keysBuilder_ == null) { - keys_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - keysBuilder_.clear(); - } - return this; - } - - public Builder removeKeys(int index) { - if (keysBuilder_ == null) { - ensureKeysIsMutable(); - keys_.remove(index); - onChanged(); - } else { - keysBuilder_.remove(index); - } - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getKeysBuilder(int index) { - return getKeysFieldBuilder().getBuilder(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder(int index) { - if (keysBuilder_ == null) { - return keys_.get(index); - } else { - return keysBuilder_.getMessageOrBuilder(index); - } - } - - public java.util.List getKeysOrBuilderList() { - if (keysBuilder_ != null) { - return keysBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(keys_); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addKeysBuilder() { - return getKeysFieldBuilder().addBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addKeysBuilder(int index) { - return getKeysFieldBuilder().addBuilder(index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public java.util.List getKeysBuilderList() { - return getKeysFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilder getKeysFieldBuilder() { - if (keysBuilder_ == null) { - keysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder( - keys_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - keys_ = null; - } - return keysBuilder_; - } - - // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; - private java.util.List columns_ = java.util.Collections.emptyList(); - - private void ensureColumnsIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { - columns_ = new java.util.ArrayList( - columns_); - bitField0_ |= 0x00000040; - } - } - - private com.google.protobuf.RepeatedFieldBuilder columnsBuilder_; - - public java.util.List getColumnsList() { - if (columnsBuilder_ == null) { - return java.util.Collections.unmodifiableList(columns_); - } else { - return columnsBuilder_.getMessageList(); - } - } - - public int getColumnsCount() { - if (columnsBuilder_ == null) { - return columns_.size(); - } else { - return columnsBuilder_.getCount(); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index) { - if (columnsBuilder_ == null) { - return columns_.get(index); - } else { - return columnsBuilder_.getMessage(index); - } - } - - public Builder setColumns(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (columnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsIsMutable(); - columns_.set(index, value); - onChanged(); - } else { - columnsBuilder_.setMessage(index, value); - } - return this; - } - - public Builder setColumns(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (columnsBuilder_ == null) { - ensureColumnsIsMutable(); - columns_.set(index, builderForValue.build()); - onChanged(); - } else { - columnsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addColumns(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (columnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsIsMutable(); - columns_.add(value); - onChanged(); - } else { - columnsBuilder_.addMessage(value); - } - return this; - } - - public Builder addColumns(int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { - if (columnsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureColumnsIsMutable(); - columns_.add(index, value); - onChanged(); - } else { - columnsBuilder_.addMessage(index, value); - } - return this; - } - - public Builder addColumns(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (columnsBuilder_ == null) { - ensureColumnsIsMutable(); - columns_.add(builderForValue.build()); - onChanged(); - } else { - columnsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - public Builder addColumns(int index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { - if (columnsBuilder_ == null) { - ensureColumnsIsMutable(); - columns_.add(index, builderForValue.build()); - onChanged(); - } else { - columnsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - public Builder addAllColumns(java.lang.Iterable values) { - if (columnsBuilder_ == null) { - ensureColumnsIsMutable(); - super.addAll(values, columns_); - onChanged(); - } else { - columnsBuilder_.addAllMessages(values); - } - return this; - } - - public Builder clearColumns() { - if (columnsBuilder_ == null) { - columns_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - } else { - columnsBuilder_.clear(); - } - return this; - } - - public Builder removeColumns(int index) { - if (columnsBuilder_ == null) { - ensureColumnsIsMutable(); - columns_.remove(index); - onChanged(); - } else { - columnsBuilder_.remove(index); - } - return this; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getColumnsBuilder(int index) { - return getColumnsFieldBuilder().getBuilder(index); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder(int index) { - if (columnsBuilder_ == null) { - return columns_.get(index); - } else { - return columnsBuilder_.getMessageOrBuilder(index); - } - } - - public java.util.List getColumnsOrBuilderList() { - if (columnsBuilder_ != null) { - return columnsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(columns_); - } - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addColumnsBuilder() { - return getColumnsFieldBuilder().addBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addColumnsBuilder(int index) { - return getColumnsFieldBuilder().addBuilder(index, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); - } - - public java.util.List getColumnsBuilderList() { - return getColumnsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilder getColumnsFieldBuilder() { - if (columnsBuilder_ == null) { - columnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder( - columns_, - ((bitField0_ & 0x00000040) == 0x00000040), - getParentForChildren(), - isClean()); - columns_ = null; - } - return columnsBuilder_; - } - - // optional int64 executeTime = 8; - private long executeTime_; - - public boolean hasExecuteTime() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - - public long getExecuteTime() { - return executeTime_; - } - - public Builder setExecuteTime(long value) { - bitField0_ |= 0x00000080; - executeTime_ = value; - onChanged(); - return this; - } - - public Builder clearExecuteTime() { - bitField0_ = (bitField0_ & ~0x00000080); - executeTime_ = 0L; - onChanged(); - return this; - } - - // optional int64 pairId = 9; - private long pairId_; - - public boolean hasPairId() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - - public long getPairId() { - return pairId_; - } - - public Builder setPairId(long value) { - bitField0_ |= 0x00000100; - pairId_ = value; - onChanged(); - return this; - } - - public Builder clearPairId() { - bitField0_ = (bitField0_ & ~0x00000100); - pairId_ = 0L; - onChanged(); - return this; - } - - // optional string syncMode = 10; - private java.lang.Object syncMode_ = ""; - - public boolean hasSyncMode() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - - public String getSyncMode() { - java.lang.Object ref = syncMode_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - syncMode_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setSyncMode(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000200; - syncMode_ = value; - onChanged(); - return this; - } - - public Builder clearSyncMode() { - bitField0_ = (bitField0_ & ~0x00000200); - syncMode_ = getDefaultInstance().getSyncMode(); - onChanged(); - return this; - } - - void setSyncMode(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000200; - syncMode_ = value; - onChanged(); - } - - // optional string syncConsistency = 11; - private java.lang.Object syncConsistency_ = ""; - - public boolean hasSyncConsistency() { - return ((bitField0_ & 0x00000400) == 0x00000400); - } - - public String getSyncConsistency() { - java.lang.Object ref = syncConsistency_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - syncConsistency_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setSyncConsistency(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000400; - syncConsistency_ = value; - onChanged(); - return this; - } - - public Builder clearSyncConsistency() { - bitField0_ = (bitField0_ & ~0x00000400); - syncConsistency_ = getDefaultInstance().getSyncConsistency(); - onChanged(); - return this; - } - - void setSyncConsistency(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000400; - syncConsistency_ = value; - onChanged(); - } - - // optional int64 size = 12; - private long size_; - - public boolean hasSize() { - return ((bitField0_ & 0x00000800) == 0x00000800); - } - - public long getSize() { - return size_; - } - - public Builder setSize(long value) { - bitField0_ |= 0x00000800; - size_ = value; - onChanged(); - return this; - } - - public Builder clearSize() { - bitField0_ = (bitField0_ & ~0x00000800); - size_ = 0L; - onChanged(); - return this; - } - - // optional bool remedy = 13; - private boolean remedy_; - - public boolean hasRemedy() { - return ((bitField0_ & 0x00001000) == 0x00001000); - } - - public boolean getRemedy() { - return remedy_; - } - - public Builder setRemedy(boolean value) { - bitField0_ |= 0x00001000; - remedy_ = value; - onChanged(); - return this; - } - - public Builder clearRemedy() { - bitField0_ = (bitField0_ & ~0x00001000); - remedy_ = false; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.RowData) - } - - static { - defaultInstance = new RowData(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.RowData) - } - - public interface ColumnOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional int32 index = 1; - boolean hasIndex(); - - int getIndex(); - - // optional string name = 2; - boolean hasName(); - - String getName(); - - // optional string value = 3; - boolean hasValue(); - - String getValue(); - - // optional bool isPrimaryKey = 4; - boolean hasIsPrimaryKey(); - - boolean getIsPrimaryKey(); - - // optional bool isNull = 5; - boolean hasIsNull(); - - boolean getIsNull(); - - // optional int32 type = 6; - boolean hasType(); - - int getType(); - - // optional bool isUpdate = 7; - boolean hasIsUpdate(); - - boolean getIsUpdate(); - } - - public static final class Column extends com.google.protobuf.GeneratedMessage implements ColumnOrBuilder { - - // Use Column.newBuilder() to construct. - private Column(Builder builder){ - super(builder); - } - - private Column(boolean noInit){ - } - - private static final Column defaultInstance; - - public static Column getDefaultInstance() { - return defaultInstance; - } - - public Column getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; - } - - private int bitField0_; - // optional int32 index = 1; - public static final int INDEX_FIELD_NUMBER = 1; - private int index_; - - public boolean hasIndex() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public int getIndex() { - return index_; - } - - // optional string name = 2; - public static final int NAME_FIELD_NUMBER = 2; - private java.lang.Object name_; - - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getName() { - java.lang.Object ref = name_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - name_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string value = 3; - public static final int VALUE_FIELD_NUMBER = 3; - private java.lang.Object value_; - - public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getValue() { - java.lang.Object ref = value_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - value_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getValueBytes() { - java.lang.Object ref = value_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional bool isPrimaryKey = 4; - public static final int ISPRIMARYKEY_FIELD_NUMBER = 4; - private boolean isPrimaryKey_; - - public boolean hasIsPrimaryKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public boolean getIsPrimaryKey() { - return isPrimaryKey_; - } - - // optional bool isNull = 5; - public static final int ISNULL_FIELD_NUMBER = 5; - private boolean isNull_; - - public boolean hasIsNull() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - public boolean getIsNull() { - return isNull_; - } - - // optional int32 type = 6; - public static final int TYPE_FIELD_NUMBER = 6; - private int type_; - - public boolean hasType() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - public int getType() { - return type_; - } - - // optional bool isUpdate = 7; - public static final int ISUPDATE_FIELD_NUMBER = 7; - private boolean isUpdate_; - - public boolean hasIsUpdate() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - public boolean getIsUpdate() { - return isUpdate_; - } - - private void initFields() { - index_ = 0; - name_ = ""; - value_ = ""; - isPrimaryKey_ = false; - isNull_ = false; - type_ = 0; - isUpdate_ = false; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeInt32(1, index_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getValueBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(4, isPrimaryKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBool(5, isNull_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeInt32(6, type_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBool(7, isUpdate_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, index_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getNameBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getValueBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, isPrimaryKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(5, isNull_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(6, type_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(7, isUpdate_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - index_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - name_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - value_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - isPrimaryKey_ = false; - bitField0_ = (bitField0_ & ~0x00000008); - isNull_ = false; - bitField0_ = (bitField0_ & ~0x00000010); - type_ = 0; - bitField0_ = (bitField0_ & ~0x00000020); - isUpdate_ = false; - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.index_ = index_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.isPrimaryKey_ = isPrimaryKey_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.isNull_ = isNull_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.isUpdate_ = isUpdate_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()) return this; - if (other.hasIndex()) { - setIndex(other.getIndex()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasValue()) { - setValue(other.getValue()); - } - if (other.hasIsPrimaryKey()) { - setIsPrimaryKey(other.getIsPrimaryKey()); - } - if (other.hasIsNull()) { - setIsNull(other.getIsNull()); - } - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasIsUpdate()) { - setIsUpdate(other.getIsUpdate()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - index_ = input.readInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - name_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - value_ = input.readBytes(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - isPrimaryKey_ = input.readBool(); - break; - } - case 40: { - bitField0_ |= 0x00000010; - isNull_ = input.readBool(); - break; - } - case 48: { - bitField0_ |= 0x00000020; - type_ = input.readInt32(); - break; - } - case 56: { - bitField0_ |= 0x00000040; - isUpdate_ = input.readBool(); - break; - } - } - } - } - - private int bitField0_; - - // optional int32 index = 1; - private int index_; - - public boolean hasIndex() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public int getIndex() { - return index_; - } - - public Builder setIndex(int value) { - bitField0_ |= 0x00000001; - index_ = value; - onChanged(); - return this; - } - - public Builder clearIndex() { - bitField0_ = (bitField0_ & ~0x00000001); - index_ = 0; - onChanged(); - return this; - } - - // optional string name = 2; - private java.lang.Object name_ = ""; - - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - name_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setName(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - return this; - } - - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000002); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - void setName(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - } - - // optional string value = 3; - private java.lang.Object value_ = ""; - - public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getValue() { - java.lang.Object ref = value_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - value_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setValue(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - value_ = value; - onChanged(); - return this; - } - - public Builder clearValue() { - bitField0_ = (bitField0_ & ~0x00000004); - value_ = getDefaultInstance().getValue(); - onChanged(); - return this; - } - - void setValue(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; - value_ = value; - onChanged(); - } - - // optional bool isPrimaryKey = 4; - private boolean isPrimaryKey_; - - public boolean hasIsPrimaryKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public boolean getIsPrimaryKey() { - return isPrimaryKey_; - } - - public Builder setIsPrimaryKey(boolean value) { - bitField0_ |= 0x00000008; - isPrimaryKey_ = value; - onChanged(); - return this; - } - - public Builder clearIsPrimaryKey() { - bitField0_ = (bitField0_ & ~0x00000008); - isPrimaryKey_ = false; - onChanged(); - return this; - } - - // optional bool isNull = 5; - private boolean isNull_; - - public boolean hasIsNull() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - public boolean getIsNull() { - return isNull_; - } - - public Builder setIsNull(boolean value) { - bitField0_ |= 0x00000010; - isNull_ = value; - onChanged(); - return this; - } - - public Builder clearIsNull() { - bitField0_ = (bitField0_ & ~0x00000010); - isNull_ = false; - onChanged(); - return this; - } - - // optional int32 type = 6; - private int type_; - - public boolean hasType() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - public int getType() { - return type_; - } - - public Builder setType(int value) { - bitField0_ |= 0x00000020; - type_ = value; - onChanged(); - return this; - } - - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000020); - type_ = 0; - onChanged(); - return this; - } - - // optional bool isUpdate = 7; - private boolean isUpdate_; - - public boolean hasIsUpdate() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - public boolean getIsUpdate() { - return isUpdate_; - } - - public Builder setIsUpdate(boolean value) { - bitField0_ |= 0x00000040; - isUpdate_ = value; - onChanged(); - return this; - } - - public Builder clearIsUpdate() { - bitField0_ = (bitField0_ & ~0x00000040); - isUpdate_ = false; - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.Column) - } - - static { - defaultInstance = new Column(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.Column) + + // optional int64 processId = 3; + public static final int PROCESSID_FIELD_NUMBER = 3; + private long processId_; + public boolean hasProcessId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getProcessId() { + return processId_; + } + + private void initFields() { + channelId_ = 0L; + pipelineId_ = 0L; + processId_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, channelId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeInt64(2, pipelineId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt64(3, processId_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, channelId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(2, pipelineId_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(3, processId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } } - - public interface FileDataOrBuilder extends com.google.protobuf.MessageOrBuilder { - - // optional string eventType = 1; - boolean hasEventType(); - - String getEventType(); - - // optional string namespace = 2; - boolean hasNamespace(); - - String getNamespace(); - - // optional string path = 3; - boolean hasPath(); - - String getPath(); - - // optional int64 lastModifiedTime = 4; - boolean hasLastModifiedTime(); - - long getLastModifiedTime(); - - // optional int64 size = 5; - boolean hasSize(); - - long getSize(); - - // optional int64 tableId = 6; - boolean hasTableId(); - - long getTableId(); - - // optional int64 pairId = 9; - boolean hasPairId(); - - long getPairId(); + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); } - - public static final class FileData extends com.google.protobuf.GeneratedMessage implements FileDataOrBuilder { - - // Use FileData.newBuilder() to construct. - private FileData(Builder builder){ - super(builder); - } - - private FileData(boolean noInit){ - } - - private static final FileData defaultInstance; - - public static FileData getDefaultInstance() { - return defaultInstance; - } - - public FileData getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; - } - - private int bitField0_; - // optional string eventType = 1; - public static final int EVENTTYPE_FIELD_NUMBER = 1; - private java.lang.Object eventType_; - - public boolean hasEventType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public String getEventType() { - java.lang.Object ref = eventType_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - eventType_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getEventTypeBytes() { - java.lang.Object ref = eventType_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - eventType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string namespace = 2; - public static final int NAMESPACE_FIELD_NUMBER = 2; - private java.lang.Object namespace_; - - public boolean hasNamespace() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getNamespace() { - java.lang.Object ref = namespace_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - namespace_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getNamespaceBytes() { - java.lang.Object ref = namespace_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - namespace_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional string path = 3; - public static final int PATH_FIELD_NUMBER = 3; - private java.lang.Object path_; - - public boolean hasPath() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getPath() { - java.lang.Object ref = path_; - if (ref instanceof String) { - return (String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - String s = bs.toStringUtf8(); - if (com.google.protobuf.Internal.isValidUtf8(bs)) { - path_ = s; - } - return s; - } - } - - private com.google.protobuf.ByteString getPathBytes() { - java.lang.Object ref = path_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - path_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - // optional int64 lastModifiedTime = 4; - public static final int LASTMODIFIEDTIME_FIELD_NUMBER = 4; - private long lastModifiedTime_; - - public boolean hasLastModifiedTime() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public long getLastModifiedTime() { - return lastModifiedTime_; - } - - // optional int64 size = 5; - public static final int SIZE_FIELD_NUMBER = 5; - private long size_; - - public boolean hasSize() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - public long getSize() { - return size_; - } - - // optional int64 tableId = 6; - public static final int TABLEID_FIELD_NUMBER = 6; - private long tableId_; - - public boolean hasTableId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - public long getTableId() { - return tableId_; - } - - // optional int64 pairId = 9; - public static final int PAIRID_FIELD_NUMBER = 9; - private long pairId_; - - public boolean hasPairId() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - public long getPairId() { - return pairId_; - } - - private void initFields() { - eventType_ = ""; - namespace_ = ""; - path_ = ""; - lastModifiedTime_ = 0L; - size_ = 0L; - tableId_ = 0L; - pairId_ = 0L; - } - - private byte memoizedIsInitialized = -1; - - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, getEventTypeBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, getNamespaceBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, getPathBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt64(4, lastModifiedTime_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt64(5, size_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeInt64(6, tableId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeInt64(9, pairId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, getEventTypeBytes()); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, getNamespaceBytes()); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, getPathBytes()); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(4, lastModifiedTime_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(5, size_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(6, tableId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(9, pairId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - - @java.lang.Override - protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseDelimitedFrom(java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - - public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry).buildParsed(); - } - - public static Builder newBuilder() { - return Builder.create(); - } - - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData prototype) { - return newBuilder().mergeFrom(prototype); - } - - public Builder toBuilder() { - return newBuilder(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - - public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder { - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; - } - - // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.newBuilder() - private Builder(){ - maybeForceBuilderInitialization(); - } - - private Builder(BuilderParent parent){ - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - eventType_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - namespace_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - path_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - lastModifiedTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000008); - size_ = 0L; - bitField0_ = (bitField0_ & ~0x00000010); - tableId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000020); - pairId_ = 0L; - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDescriptor(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getDefaultInstanceForType() { - return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance(); - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData build() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); - } - return result; - } - - public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData buildPartial() { - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData( - this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.eventType_ = eventType_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.namespace_ = namespace_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.path_ = path_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.lastModifiedTime_ = lastModifiedTime_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.size_ = size_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.tableId_ = tableId_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.pairId_ = pairId_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData) { - return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData other) { - if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()) return this; - if (other.hasEventType()) { - setEventType(other.getEventType()); - } - if (other.hasNamespace()) { - setNamespace(other.getNamespace()); - } - if (other.hasPath()) { - setPath(other.getPath()); - } - if (other.hasLastModifiedTime()) { - setLastModifiedTime(other.getLastModifiedTime()); - } - if (other.hasSize()) { - setSize(other.getSize()); - } - if (other.hasTableId()) { - setTableId(other.getTableId()); - } - if (other.hasPairId()) { - setPairId(other.getPairId()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom(com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - default: { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - onChanged(); - return this; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - eventType_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - namespace_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - path_ = input.readBytes(); - break; - } - case 32: { - bitField0_ |= 0x00000008; - lastModifiedTime_ = input.readInt64(); - break; - } - case 40: { - bitField0_ |= 0x00000010; - size_ = input.readInt64(); - break; - } - case 48: { - bitField0_ |= 0x00000020; - tableId_ = input.readInt64(); - break; - } - case 72: { - bitField0_ |= 0x00000040; - pairId_ = input.readInt64(); - break; - } - } - } - } - - private int bitField0_; - - // optional string eventType = 1; - private java.lang.Object eventType_ = ""; - - public boolean hasEventType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - - public String getEventType() { - java.lang.Object ref = eventType_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - eventType_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setEventType(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - eventType_ = value; - onChanged(); - return this; - } - - public Builder clearEventType() { - bitField0_ = (bitField0_ & ~0x00000001); - eventType_ = getDefaultInstance().getEventType(); - onChanged(); - return this; - } - - void setEventType(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000001; - eventType_ = value; - onChanged(); - } - - // optional string namespace = 2; - private java.lang.Object namespace_ = ""; - - public boolean hasNamespace() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - - public String getNamespace() { - java.lang.Object ref = namespace_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - namespace_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setNamespace(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - namespace_ = value; - onChanged(); - return this; - } - - public Builder clearNamespace() { - bitField0_ = (bitField0_ & ~0x00000002); - namespace_ = getDefaultInstance().getNamespace(); - onChanged(); - return this; - } - - void setNamespace(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000002; - namespace_ = value; - onChanged(); - } - - // optional string path = 3; - private java.lang.Object path_ = ""; - - public boolean hasPath() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - - public String getPath() { - java.lang.Object ref = path_; - if (!(ref instanceof String)) { - String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); - path_ = s; - return s; - } else { - return (String) ref; - } - } - - public Builder setPath(String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - path_ = value; - onChanged(); - return this; - } - - public Builder clearPath() { - bitField0_ = (bitField0_ & ~0x00000004); - path_ = getDefaultInstance().getPath(); - onChanged(); - return this; - } - - void setPath(com.google.protobuf.ByteString value) { - bitField0_ |= 0x00000004; - path_ = value; - onChanged(); - } - - // optional int64 lastModifiedTime = 4; - private long lastModifiedTime_; - - public boolean hasLastModifiedTime() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - - public long getLastModifiedTime() { - return lastModifiedTime_; - } - - public Builder setLastModifiedTime(long value) { - bitField0_ |= 0x00000008; - lastModifiedTime_ = value; - onChanged(); - return this; - } - - public Builder clearLastModifiedTime() { - bitField0_ = (bitField0_ & ~0x00000008); - lastModifiedTime_ = 0L; - onChanged(); - return this; - } - - // optional int64 size = 5; - private long size_; - - public boolean hasSize() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - - public long getSize() { - return size_; - } - - public Builder setSize(long value) { - bitField0_ |= 0x00000010; - size_ = value; - onChanged(); - return this; - } - - public Builder clearSize() { - bitField0_ = (bitField0_ & ~0x00000010); - size_ = 0L; + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + channelId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + pipelineId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000002); + processId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.channelId_ = channelId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.pipelineId_ = pipelineId_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.processId_ = processId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) return this; + if (other.hasChannelId()) { + setChannelId(other.getChannelId()); + } + if (other.hasPipelineId()) { + setPipelineId(other.getPipelineId()); + } + if (other.hasProcessId()) { + setProcessId(other.getProcessId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); onChanged(); return this; - } - - // optional int64 tableId = 6; - private long tableId_; - - public boolean hasTableId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - - public long getTableId() { - return tableId_; - } - - public Builder setTableId(long value) { - bitField0_ |= 0x00000020; - tableId_ = value; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + channelId_ = input.readInt64(); + break; + } + case 16: { + bitField0_ |= 0x00000002; + pipelineId_ = input.readInt64(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + processId_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 channelId = 1; + private long channelId_ ; + public boolean hasChannelId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getChannelId() { + return channelId_; + } + public Builder setChannelId(long value) { + bitField0_ |= 0x00000001; + channelId_ = value; + onChanged(); + return this; + } + public Builder clearChannelId() { + bitField0_ = (bitField0_ & ~0x00000001); + channelId_ = 0L; + onChanged(); + return this; + } + + // optional int64 pipelineId = 2; + private long pipelineId_ ; + public boolean hasPipelineId() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public long getPipelineId() { + return pipelineId_; + } + public Builder setPipelineId(long value) { + bitField0_ |= 0x00000002; + pipelineId_ = value; + onChanged(); + return this; + } + public Builder clearPipelineId() { + bitField0_ = (bitField0_ & ~0x00000002); + pipelineId_ = 0L; + onChanged(); + return this; + } + + // optional int64 processId = 3; + private long processId_ ; + public boolean hasProcessId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public long getProcessId() { + return processId_; + } + public Builder setProcessId(long value) { + bitField0_ |= 0x00000004; + processId_ = value; + onChanged(); + return this; + } + public Builder clearProcessId() { + bitField0_ = (bitField0_ & ~0x00000004); + processId_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.Identity) + } + + static { + defaultInstance = new Identity(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.Identity) + } + + public interface RowBatchOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + boolean hasIdentity(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder(); + + // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; + java.util.List + getRowsList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index); + int getRowsCount(); + java.util.List + getRowsOrBuilderList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder( + int index); + } + public static final class RowBatch extends + com.google.protobuf.GeneratedMessage + implements RowBatchOrBuilder { + // Use RowBatch.newBuilder() to construct. + private RowBatch(Builder builder) { + super(builder); + } + private RowBatch(boolean noInit) {} + + private static final RowBatch defaultInstance; + public static RowBatch getDefaultInstance() { + return defaultInstance; + } + + public RowBatch getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + public static final int IDENTITY_FIELD_NUMBER = 1; + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_; + public boolean hasIdentity() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { + return identity_; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { + return identity_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; + public static final int ROWS_FIELD_NUMBER = 2; + private java.util.List rows_; + public java.util.List getRowsList() { + return rows_; + } + public java.util.List + getRowsOrBuilderList() { + return rows_; + } + public int getRowsCount() { + return rows_.size(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index) { + return rows_.get(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder( + int index) { + return rows_.get(index); + } + + private void initFields() { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + rows_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, identity_); + } + for (int i = 0; i < rows_.size(); i++) { + output.writeMessage(2, rows_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, identity_); + } + for (int i = 0; i < rows_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, rows_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatchOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getIdentityFieldBuilder(); + getRowsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (identityBuilder_ == null) { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + } else { + identityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + rowsBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (identityBuilder_ == null) { + result.identity_ = identity_; + } else { + result.identity_ = identityBuilder_.build(); + } + if (rowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = java.util.Collections.unmodifiableList(rows_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.rows_ = rows_; + } else { + result.rows_ = rowsBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.getDefaultInstance()) return this; + if (other.hasIdentity()) { + mergeIdentity(other.getIdentity()); + } + if (rowsBuilder_ == null) { + if (!other.rows_.isEmpty()) { + if (rows_.isEmpty()) { + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureRowsIsMutable(); + rows_.addAll(other.rows_); + } + onChanged(); + } + } else { + if (!other.rows_.isEmpty()) { + if (rowsBuilder_.isEmpty()) { + rowsBuilder_.dispose(); + rowsBuilder_ = null; + rows_ = other.rows_; + bitField0_ = (bitField0_ & ~0x00000002); + rowsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getRowsFieldBuilder() : null; + } else { + rowsBuilder_.addAllMessages(other.rows_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); onChanged(); return this; - } - - public Builder clearTableId() { - bitField0_ = (bitField0_ & ~0x00000020); - tableId_ = 0L; + } + break; + } + case 10: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(); + if (hasIdentity()) { + subBuilder.mergeFrom(getIdentity()); + } + input.readMessage(subBuilder, extensionRegistry); + setIdentity(subBuilder.buildPartial()); + break; + } + case 18: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRows(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder> identityBuilder_; + public boolean hasIdentity() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { + if (identityBuilder_ == null) { + return identity_; + } else { + return identityBuilder_.getMessage(); + } + } + public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { + if (identityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + identity_ = value; + onChanged(); + } else { + identityBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setIdentity( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder builderForValue) { + if (identityBuilder_ == null) { + identity_ = builderForValue.build(); + onChanged(); + } else { + identityBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { + if (identityBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + identity_ != com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) { + identity_ = + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(identity_).mergeFrom(value).buildPartial(); + } else { + identity_ = value; + } + onChanged(); + } else { + identityBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearIdentity() { + if (identityBuilder_ == null) { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + onChanged(); + } else { + identityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder getIdentityBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getIdentityFieldBuilder().getBuilder(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { + if (identityBuilder_ != null) { + return identityBuilder_.getMessageOrBuilder(); + } else { + return identity_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder> + getIdentityFieldBuilder() { + if (identityBuilder_ == null) { + identityBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder>( + identity_, + getParentForChildren(), + isClean()); + identity_ = null; + } + return identityBuilder_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.RowData rows = 2; + private java.util.List rows_ = + java.util.Collections.emptyList(); + private void ensureRowsIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + rows_ = new java.util.ArrayList(rows_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder> rowsBuilder_; + + public java.util.List getRowsList() { + if (rowsBuilder_ == null) { + return java.util.Collections.unmodifiableList(rows_); + } else { + return rowsBuilder_.getMessageList(); + } + } + public int getRowsCount() { + if (rowsBuilder_ == null) { + return rows_.size(); + } else { + return rowsBuilder_.getCount(); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getRows(int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); + } else { + return rowsBuilder_.getMessage(index); + } + } + public Builder setRows( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.set(index, value); + onChanged(); + } else { + rowsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setRows( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.set(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addRows(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(value); + onChanged(); + } else { + rowsBuilder_.addMessage(value); + } + return this; + } + public Builder addRows( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData value) { + if (rowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRowsIsMutable(); + rows_.add(index, value); + onChanged(); + } else { + rowsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addRows( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addRows( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder builderForValue) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.add(index, builderForValue.build()); + onChanged(); + } else { + rowsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllRows( + java.lang.Iterable values) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + super.addAll(values, rows_); + onChanged(); + } else { + rowsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearRows() { + if (rowsBuilder_ == null) { + rows_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + rowsBuilder_.clear(); + } + return this; + } + public Builder removeRows(int index) { + if (rowsBuilder_ == null) { + ensureRowsIsMutable(); + rows_.remove(index); + onChanged(); + } else { + rowsBuilder_.remove(index); + } + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder getRowsBuilder( + int index) { + return getRowsFieldBuilder().getBuilder(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder getRowsOrBuilder( + int index) { + if (rowsBuilder_ == null) { + return rows_.get(index); } else { + return rowsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getRowsOrBuilderList() { + if (rowsBuilder_ != null) { + return rowsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(rows_); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder addRowsBuilder() { + return getRowsFieldBuilder().addBuilder( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder addRowsBuilder( + int index) { + return getRowsFieldBuilder().addBuilder( + index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()); + } + public java.util.List + getRowsBuilderList() { + return getRowsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder> + getRowsFieldBuilder() { + if (rowsBuilder_ == null) { + rowsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder>( + rows_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + rows_ = null; + } + return rowsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.RowBatch) + } + + static { + defaultInstance = new RowBatch(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.RowBatch) + } + + public interface FileBatchOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + boolean hasIdentity(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder(); + + // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; + java.util.List + getFilesList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index); + int getFilesCount(); + java.util.List + getFilesOrBuilderList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder( + int index); + } + public static final class FileBatch extends + com.google.protobuf.GeneratedMessage + implements FileBatchOrBuilder { + // Use FileBatch.newBuilder() to construct. + private FileBatch(Builder builder) { + super(builder); + } + private FileBatch(boolean noInit) {} + + private static final FileBatch defaultInstance; + public static FileBatch getDefaultInstance() { + return defaultInstance; + } + + public FileBatch getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; + } + + private int bitField0_; + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + public static final int IDENTITY_FIELD_NUMBER = 1; + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_; + public boolean hasIdentity() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { + return identity_; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { + return identity_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; + public static final int FILES_FIELD_NUMBER = 2; + private java.util.List files_; + public java.util.List getFilesList() { + return files_; + } + public java.util.List + getFilesOrBuilderList() { + return files_; + } + public int getFilesCount() { + return files_.size(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index) { + return files_.get(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder( + int index) { + return files_.get(index); + } + + private void initFields() { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + files_ = java.util.Collections.emptyList(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, identity_); + } + for (int i = 0; i < files_.size(); i++) { + output.writeMessage(2, files_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, identity_); + } + for (int i = 0; i < files_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, files_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatchOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getIdentityFieldBuilder(); + getFilesFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (identityBuilder_ == null) { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + } else { + identityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (filesBuilder_ == null) { + files_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + filesBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (identityBuilder_ == null) { + result.identity_ = identity_; + } else { + result.identity_ = identityBuilder_.build(); + } + if (filesBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002)) { + files_ = java.util.Collections.unmodifiableList(files_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.files_ = files_; + } else { + result.files_ = filesBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.getDefaultInstance()) return this; + if (other.hasIdentity()) { + mergeIdentity(other.getIdentity()); + } + if (filesBuilder_ == null) { + if (!other.files_.isEmpty()) { + if (files_.isEmpty()) { + files_ = other.files_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureFilesIsMutable(); + files_.addAll(other.files_); + } + onChanged(); + } + } else { + if (!other.files_.isEmpty()) { + if (filesBuilder_.isEmpty()) { + filesBuilder_.dispose(); + filesBuilder_ = null; + files_ = other.files_; + bitField0_ = (bitField0_ & ~0x00000002); + filesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getFilesFieldBuilder() : null; + } else { + filesBuilder_.addAllMessages(other.files_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); onChanged(); return this; + } + break; + } + case 10: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(); + if (hasIdentity()) { + subBuilder.mergeFrom(getIdentity()); + } + input.readMessage(subBuilder, extensionRegistry); + setIdentity(subBuilder.buildPartial()); + break; + } + case 18: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addFiles(subBuilder.buildPartial()); + break; + } + } + } + } + + private int bitField0_; + + // optional .com.alibaba.otter.node.etl.model.protobuf.Identity identity = 1; + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder> identityBuilder_; + public boolean hasIdentity() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity getIdentity() { + if (identityBuilder_ == null) { + return identity_; + } else { + return identityBuilder_.getMessage(); + } + } + public Builder setIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { + if (identityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + identity_ = value; + onChanged(); + } else { + identityBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setIdentity( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder builderForValue) { + if (identityBuilder_ == null) { + identity_ = builderForValue.build(); + onChanged(); + } else { + identityBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeIdentity(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity value) { + if (identityBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + identity_ != com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance()) { + identity_ = + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.newBuilder(identity_).mergeFrom(value).buildPartial(); + } else { + identity_ = value; + } + onChanged(); + } else { + identityBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearIdentity() { + if (identityBuilder_ == null) { + identity_ = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.getDefaultInstance(); + onChanged(); + } else { + identityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder getIdentityBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getIdentityFieldBuilder().getBuilder(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder getIdentityOrBuilder() { + if (identityBuilder_ != null) { + return identityBuilder_.getMessageOrBuilder(); + } else { + return identity_; + } + } + private com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder> + getIdentityFieldBuilder() { + if (identityBuilder_ == null) { + identityBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.IdentityOrBuilder>( + identity_, + getParentForChildren(), + isClean()); + identity_ = null; + } + return identityBuilder_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.FileData files = 2; + private java.util.List files_ = + java.util.Collections.emptyList(); + private void ensureFilesIsMutable() { + if (!((bitField0_ & 0x00000002) == 0x00000002)) { + files_ = new java.util.ArrayList(files_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder> filesBuilder_; + + public java.util.List getFilesList() { + if (filesBuilder_ == null) { + return java.util.Collections.unmodifiableList(files_); + } else { + return filesBuilder_.getMessageList(); + } + } + public int getFilesCount() { + if (filesBuilder_ == null) { + return files_.size(); + } else { + return filesBuilder_.getCount(); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getFiles(int index) { + if (filesBuilder_ == null) { + return files_.get(index); + } else { + return filesBuilder_.getMessage(index); + } + } + public Builder setFiles( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.set(index, value); + onChanged(); + } else { + filesBuilder_.setMessage(index, value); + } + return this; + } + public Builder setFiles( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.set(index, builderForValue.build()); + onChanged(); + } else { + filesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addFiles(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.add(value); + onChanged(); + } else { + filesBuilder_.addMessage(value); + } + return this; + } + public Builder addFiles( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData value) { + if (filesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureFilesIsMutable(); + files_.add(index, value); + onChanged(); + } else { + filesBuilder_.addMessage(index, value); + } + return this; + } + public Builder addFiles( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.add(builderForValue.build()); + onChanged(); + } else { + filesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addFiles( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder builderForValue) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.add(index, builderForValue.build()); + onChanged(); + } else { + filesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllFiles( + java.lang.Iterable values) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + super.addAll(values, files_); + onChanged(); + } else { + filesBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearFiles() { + if (filesBuilder_ == null) { + files_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + filesBuilder_.clear(); + } + return this; + } + public Builder removeFiles(int index) { + if (filesBuilder_ == null) { + ensureFilesIsMutable(); + files_.remove(index); + onChanged(); + } else { + filesBuilder_.remove(index); + } + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder getFilesBuilder( + int index) { + return getFilesFieldBuilder().getBuilder(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder getFilesOrBuilder( + int index) { + if (filesBuilder_ == null) { + return files_.get(index); } else { + return filesBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getFilesOrBuilderList() { + if (filesBuilder_ != null) { + return filesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(files_); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder addFilesBuilder() { + return getFilesFieldBuilder().addBuilder( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder addFilesBuilder( + int index) { + return getFilesFieldBuilder().addBuilder( + index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()); + } + public java.util.List + getFilesBuilderList() { + return getFilesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder> + getFilesFieldBuilder() { + if (filesBuilder_ == null) { + filesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder>( + files_, + ((bitField0_ & 0x00000002) == 0x00000002), + getParentForChildren(), + isClean()); + files_ = null; + } + return filesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.FileBatch) + } + + static { + defaultInstance = new FileBatch(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.FileBatch) + } + + public interface RowDataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int64 tableId = 1; + boolean hasTableId(); + long getTableId(); + + // optional string schemaName = 2; + boolean hasSchemaName(); + String getSchemaName(); + + // optional string tableName = 3; + boolean hasTableName(); + String getTableName(); + + // optional string eventType = 4; + boolean hasEventType(); + String getEventType(); + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; + java.util.List + getOldKeysList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index); + int getOldKeysCount(); + java.util.List + getOldKeysOrBuilderList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder( + int index); + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; + java.util.List + getKeysList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index); + int getKeysCount(); + java.util.List + getKeysOrBuilderList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder( + int index); + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; + java.util.List + getColumnsList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index); + int getColumnsCount(); + java.util.List + getColumnsOrBuilderList(); + com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder( + int index); + + // optional int64 executeTime = 8; + boolean hasExecuteTime(); + long getExecuteTime(); + + // optional int64 pairId = 9; + boolean hasPairId(); + long getPairId(); + + // optional string syncMode = 10; + boolean hasSyncMode(); + String getSyncMode(); + + // optional string syncConsistency = 11; + boolean hasSyncConsistency(); + String getSyncConsistency(); + + // optional int64 size = 12; + boolean hasSize(); + long getSize(); + + // optional bool remedy = 13; + boolean hasRemedy(); + boolean getRemedy(); + } + public static final class RowData extends + com.google.protobuf.GeneratedMessage + implements RowDataOrBuilder { + // Use RowData.newBuilder() to construct. + private RowData(Builder builder) { + super(builder); + } + private RowData(boolean noInit) {} + + private static final RowData defaultInstance; + public static RowData getDefaultInstance() { + return defaultInstance; + } + + public RowData getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; + } + + private int bitField0_; + // optional int64 tableId = 1; + public static final int TABLEID_FIELD_NUMBER = 1; + private long tableId_; + public boolean hasTableId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTableId() { + return tableId_; + } + + // optional string schemaName = 2; + public static final int SCHEMANAME_FIELD_NUMBER = 2; + private java.lang.Object schemaName_; + public boolean hasSchemaName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getSchemaName() { + java.lang.Object ref = schemaName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + schemaName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getSchemaNameBytes() { + java.lang.Object ref = schemaName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + schemaName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string tableName = 3; + public static final int TABLENAME_FIELD_NUMBER = 3; + private java.lang.Object tableName_; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + tableName_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getTableNameBytes() { + java.lang.Object ref = tableName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + tableName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string eventType = 4; + public static final int EVENTTYPE_FIELD_NUMBER = 4; + private java.lang.Object eventType_; + public boolean hasEventType() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getEventType() { + java.lang.Object ref = eventType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + eventType_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getEventTypeBytes() { + java.lang.Object ref = eventType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + eventType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; + public static final int OLDKEYS_FIELD_NUMBER = 5; + private java.util.List oldKeys_; + public java.util.List getOldKeysList() { + return oldKeys_; + } + public java.util.List + getOldKeysOrBuilderList() { + return oldKeys_; + } + public int getOldKeysCount() { + return oldKeys_.size(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index) { + return oldKeys_.get(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder( + int index) { + return oldKeys_.get(index); + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; + public static final int KEYS_FIELD_NUMBER = 6; + private java.util.List keys_; + public java.util.List getKeysList() { + return keys_; + } + public java.util.List + getKeysOrBuilderList() { + return keys_; + } + public int getKeysCount() { + return keys_.size(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index) { + return keys_.get(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder( + int index) { + return keys_.get(index); + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; + public static final int COLUMNS_FIELD_NUMBER = 7; + private java.util.List columns_; + public java.util.List getColumnsList() { + return columns_; + } + public java.util.List + getColumnsOrBuilderList() { + return columns_; + } + public int getColumnsCount() { + return columns_.size(); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index) { + return columns_.get(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder( + int index) { + return columns_.get(index); + } + + // optional int64 executeTime = 8; + public static final int EXECUTETIME_FIELD_NUMBER = 8; + private long executeTime_; + public boolean hasExecuteTime() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getExecuteTime() { + return executeTime_; + } + + // optional int64 pairId = 9; + public static final int PAIRID_FIELD_NUMBER = 9; + private long pairId_; + public boolean hasPairId() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getPairId() { + return pairId_; + } + + // optional string syncMode = 10; + public static final int SYNCMODE_FIELD_NUMBER = 10; + private java.lang.Object syncMode_; + public boolean hasSyncMode() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public String getSyncMode() { + java.lang.Object ref = syncMode_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + syncMode_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getSyncModeBytes() { + java.lang.Object ref = syncMode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + syncMode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string syncConsistency = 11; + public static final int SYNCCONSISTENCY_FIELD_NUMBER = 11; + private java.lang.Object syncConsistency_; + public boolean hasSyncConsistency() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public String getSyncConsistency() { + java.lang.Object ref = syncConsistency_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + syncConsistency_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getSyncConsistencyBytes() { + java.lang.Object ref = syncConsistency_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + syncConsistency_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int64 size = 12; + public static final int SIZE_FIELD_NUMBER = 12; + private long size_; + public boolean hasSize() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public long getSize() { + return size_; + } + + // optional bool remedy = 13; + public static final int REMEDY_FIELD_NUMBER = 13; + private boolean remedy_; + public boolean hasRemedy() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + public boolean getRemedy() { + return remedy_; + } + + private void initFields() { + tableId_ = 0L; + schemaName_ = ""; + tableName_ = ""; + eventType_ = ""; + oldKeys_ = java.util.Collections.emptyList(); + keys_ = java.util.Collections.emptyList(); + columns_ = java.util.Collections.emptyList(); + executeTime_ = 0L; + pairId_ = 0L; + syncMode_ = ""; + syncConsistency_ = ""; + size_ = 0L; + remedy_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt64(1, tableId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getSchemaNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, getEventTypeBytes()); + } + for (int i = 0; i < oldKeys_.size(); i++) { + output.writeMessage(5, oldKeys_.get(i)); + } + for (int i = 0; i < keys_.size(); i++) { + output.writeMessage(6, keys_.get(i)); + } + for (int i = 0; i < columns_.size(); i++) { + output.writeMessage(7, columns_.get(i)); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt64(8, executeTime_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt64(9, pairId_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBytes(10, getSyncModeBytes()); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + output.writeBytes(11, getSyncConsistencyBytes()); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + output.writeInt64(12, size_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + output.writeBool(13, remedy_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(1, tableId_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getSchemaNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getTableNameBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, getEventTypeBytes()); + } + for (int i = 0; i < oldKeys_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, oldKeys_.get(i)); + } + for (int i = 0; i < keys_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, keys_.get(i)); + } + for (int i = 0; i < columns_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, columns_.get(i)); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(8, executeTime_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(9, pairId_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(10, getSyncModeBytes()); + } + if (((bitField0_ & 0x00000080) == 0x00000080)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(11, getSyncConsistencyBytes()); + } + if (((bitField0_ & 0x00000100) == 0x00000100)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(12, size_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(13, remedy_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getOldKeysFieldBuilder(); + getKeysFieldBuilder(); + getColumnsFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + tableId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000001); + schemaName_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + tableName_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + eventType_ = ""; + bitField0_ = (bitField0_ & ~0x00000008); + if (oldKeysBuilder_ == null) { + oldKeys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + } else { + oldKeysBuilder_.clear(); + } + if (keysBuilder_ == null) { + keys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + } else { + keysBuilder_.clear(); + } + if (columnsBuilder_ == null) { + columns_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + } else { + columnsBuilder_.clear(); + } + executeTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000080); + pairId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000100); + syncMode_ = ""; + bitField0_ = (bitField0_ & ~0x00000200); + syncConsistency_ = ""; + bitField0_ = (bitField0_ & ~0x00000400); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000800); + remedy_ = false; + bitField0_ = (bitField0_ & ~0x00001000); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.tableId_ = tableId_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.schemaName_ = schemaName_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.tableName_ = tableName_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.eventType_ = eventType_; + if (oldKeysBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { + oldKeys_ = java.util.Collections.unmodifiableList(oldKeys_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.oldKeys_ = oldKeys_; + } else { + result.oldKeys_ = oldKeysBuilder_.build(); + } + if (keysBuilder_ == null) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { + keys_ = java.util.Collections.unmodifiableList(keys_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.keys_ = keys_; + } else { + result.keys_ = keysBuilder_.build(); + } + if (columnsBuilder_ == null) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { + columns_ = java.util.Collections.unmodifiableList(columns_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.columns_ = columns_; + } else { + result.columns_ = columnsBuilder_.build(); + } + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + to_bitField0_ |= 0x00000010; + } + result.executeTime_ = executeTime_; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000020; + } + result.pairId_ = pairId_; + if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + to_bitField0_ |= 0x00000040; + } + result.syncMode_ = syncMode_; + if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + to_bitField0_ |= 0x00000080; + } + result.syncConsistency_ = syncConsistency_; + if (((from_bitField0_ & 0x00000800) == 0x00000800)) { + to_bitField0_ |= 0x00000100; + } + result.size_ = size_; + if (((from_bitField0_ & 0x00001000) == 0x00001000)) { + to_bitField0_ |= 0x00000200; + } + result.remedy_ = remedy_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.getDefaultInstance()) return this; + if (other.hasTableId()) { + setTableId(other.getTableId()); + } + if (other.hasSchemaName()) { + setSchemaName(other.getSchemaName()); + } + if (other.hasTableName()) { + setTableName(other.getTableName()); + } + if (other.hasEventType()) { + setEventType(other.getEventType()); + } + if (oldKeysBuilder_ == null) { + if (!other.oldKeys_.isEmpty()) { + if (oldKeys_.isEmpty()) { + oldKeys_ = other.oldKeys_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureOldKeysIsMutable(); + oldKeys_.addAll(other.oldKeys_); + } + onChanged(); + } + } else { + if (!other.oldKeys_.isEmpty()) { + if (oldKeysBuilder_.isEmpty()) { + oldKeysBuilder_.dispose(); + oldKeysBuilder_ = null; + oldKeys_ = other.oldKeys_; + bitField0_ = (bitField0_ & ~0x00000010); + oldKeysBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getOldKeysFieldBuilder() : null; + } else { + oldKeysBuilder_.addAllMessages(other.oldKeys_); } - - // optional int64 pairId = 9; - private long pairId_; - - public boolean hasPairId() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - - public long getPairId() { - return pairId_; + } + } + if (keysBuilder_ == null) { + if (!other.keys_.isEmpty()) { + if (keys_.isEmpty()) { + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureKeysIsMutable(); + keys_.addAll(other.keys_); + } + onChanged(); + } + } else { + if (!other.keys_.isEmpty()) { + if (keysBuilder_.isEmpty()) { + keysBuilder_.dispose(); + keysBuilder_ = null; + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000020); + keysBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getKeysFieldBuilder() : null; + } else { + keysBuilder_.addAllMessages(other.keys_); } - - public Builder setPairId(long value) { - bitField0_ |= 0x00000040; - pairId_ = value; + } + } + if (columnsBuilder_ == null) { + if (!other.columns_.isEmpty()) { + if (columns_.isEmpty()) { + columns_ = other.columns_; + bitField0_ = (bitField0_ & ~0x00000040); + } else { + ensureColumnsIsMutable(); + columns_.addAll(other.columns_); + } + onChanged(); + } + } else { + if (!other.columns_.isEmpty()) { + if (columnsBuilder_.isEmpty()) { + columnsBuilder_.dispose(); + columnsBuilder_ = null; + columns_ = other.columns_; + bitField0_ = (bitField0_ & ~0x00000040); + columnsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getColumnsFieldBuilder() : null; + } else { + columnsBuilder_.addAllMessages(other.columns_); + } + } + } + if (other.hasExecuteTime()) { + setExecuteTime(other.getExecuteTime()); + } + if (other.hasPairId()) { + setPairId(other.getPairId()); + } + if (other.hasSyncMode()) { + setSyncMode(other.getSyncMode()); + } + if (other.hasSyncConsistency()) { + setSyncConsistency(other.getSyncConsistency()); + } + if (other.hasSize()) { + setSize(other.getSize()); + } + if (other.hasRemedy()) { + setRemedy(other.getRemedy()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); onChanged(); return this; - } - - public Builder clearPairId() { - bitField0_ = (bitField0_ & ~0x00000040); - pairId_ = 0L; + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + tableId_ = input.readInt64(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + schemaName_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + tableName_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + eventType_ = input.readBytes(); + break; + } + case 42: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addOldKeys(subBuilder.buildPartial()); + break; + } + case 50: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addKeys(subBuilder.buildPartial()); + break; + } + case 58: { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder subBuilder = com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addColumns(subBuilder.buildPartial()); + break; + } + case 64: { + bitField0_ |= 0x00000080; + executeTime_ = input.readInt64(); + break; + } + case 72: { + bitField0_ |= 0x00000100; + pairId_ = input.readInt64(); + break; + } + case 82: { + bitField0_ |= 0x00000200; + syncMode_ = input.readBytes(); + break; + } + case 90: { + bitField0_ |= 0x00000400; + syncConsistency_ = input.readBytes(); + break; + } + case 96: { + bitField0_ |= 0x00000800; + size_ = input.readInt64(); + break; + } + case 104: { + bitField0_ |= 0x00001000; + remedy_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // optional int64 tableId = 1; + private long tableId_ ; + public boolean hasTableId() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public long getTableId() { + return tableId_; + } + public Builder setTableId(long value) { + bitField0_ |= 0x00000001; + tableId_ = value; + onChanged(); + return this; + } + public Builder clearTableId() { + bitField0_ = (bitField0_ & ~0x00000001); + tableId_ = 0L; + onChanged(); + return this; + } + + // optional string schemaName = 2; + private java.lang.Object schemaName_ = ""; + public boolean hasSchemaName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getSchemaName() { + java.lang.Object ref = schemaName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + schemaName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setSchemaName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + schemaName_ = value; + onChanged(); + return this; + } + public Builder clearSchemaName() { + bitField0_ = (bitField0_ & ~0x00000002); + schemaName_ = getDefaultInstance().getSchemaName(); + onChanged(); + return this; + } + void setSchemaName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + schemaName_ = value; + onChanged(); + } + + // optional string tableName = 3; + private java.lang.Object tableName_ = ""; + public boolean hasTableName() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getTableName() { + java.lang.Object ref = tableName_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + tableName_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setTableName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + return this; + } + public Builder clearTableName() { + bitField0_ = (bitField0_ & ~0x00000004); + tableName_ = getDefaultInstance().getTableName(); + onChanged(); + return this; + } + void setTableName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + tableName_ = value; + onChanged(); + } + + // optional string eventType = 4; + private java.lang.Object eventType_ = ""; + public boolean hasEventType() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public String getEventType() { + java.lang.Object ref = eventType_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + eventType_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setEventType(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + eventType_ = value; + onChanged(); + return this; + } + public Builder clearEventType() { + bitField0_ = (bitField0_ & ~0x00000008); + eventType_ = getDefaultInstance().getEventType(); + onChanged(); + return this; + } + void setEventType(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000008; + eventType_ = value; + onChanged(); + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column oldKeys = 5; + private java.util.List oldKeys_ = + java.util.Collections.emptyList(); + private void ensureOldKeysIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + oldKeys_ = new java.util.ArrayList(oldKeys_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> oldKeysBuilder_; + + public java.util.List getOldKeysList() { + if (oldKeysBuilder_ == null) { + return java.util.Collections.unmodifiableList(oldKeys_); + } else { + return oldKeysBuilder_.getMessageList(); + } + } + public int getOldKeysCount() { + if (oldKeysBuilder_ == null) { + return oldKeys_.size(); + } else { + return oldKeysBuilder_.getCount(); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getOldKeys(int index) { + if (oldKeysBuilder_ == null) { + return oldKeys_.get(index); + } else { + return oldKeysBuilder_.getMessage(index); + } + } + public Builder setOldKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (oldKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOldKeysIsMutable(); + oldKeys_.set(index, value); + onChanged(); + } else { + oldKeysBuilder_.setMessage(index, value); + } + return this; + } + public Builder setOldKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (oldKeysBuilder_ == null) { + ensureOldKeysIsMutable(); + oldKeys_.set(index, builderForValue.build()); + onChanged(); + } else { + oldKeysBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addOldKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (oldKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOldKeysIsMutable(); + oldKeys_.add(value); + onChanged(); + } else { + oldKeysBuilder_.addMessage(value); + } + return this; + } + public Builder addOldKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (oldKeysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOldKeysIsMutable(); + oldKeys_.add(index, value); + onChanged(); + } else { + oldKeysBuilder_.addMessage(index, value); + } + return this; + } + public Builder addOldKeys( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (oldKeysBuilder_ == null) { + ensureOldKeysIsMutable(); + oldKeys_.add(builderForValue.build()); + onChanged(); + } else { + oldKeysBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addOldKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (oldKeysBuilder_ == null) { + ensureOldKeysIsMutable(); + oldKeys_.add(index, builderForValue.build()); + onChanged(); + } else { + oldKeysBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllOldKeys( + java.lang.Iterable values) { + if (oldKeysBuilder_ == null) { + ensureOldKeysIsMutable(); + super.addAll(values, oldKeys_); + onChanged(); + } else { + oldKeysBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearOldKeys() { + if (oldKeysBuilder_ == null) { + oldKeys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + oldKeysBuilder_.clear(); + } + return this; + } + public Builder removeOldKeys(int index) { + if (oldKeysBuilder_ == null) { + ensureOldKeysIsMutable(); + oldKeys_.remove(index); + onChanged(); + } else { + oldKeysBuilder_.remove(index); + } + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getOldKeysBuilder( + int index) { + return getOldKeysFieldBuilder().getBuilder(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getOldKeysOrBuilder( + int index) { + if (oldKeysBuilder_ == null) { + return oldKeys_.get(index); } else { + return oldKeysBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getOldKeysOrBuilderList() { + if (oldKeysBuilder_ != null) { + return oldKeysBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(oldKeys_); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addOldKeysBuilder() { + return getOldKeysFieldBuilder().addBuilder( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addOldKeysBuilder( + int index) { + return getOldKeysFieldBuilder().addBuilder( + index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public java.util.List + getOldKeysBuilderList() { + return getOldKeysFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> + getOldKeysFieldBuilder() { + if (oldKeysBuilder_ == null) { + oldKeysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder>( + oldKeys_, + ((bitField0_ & 0x00000010) == 0x00000010), + getParentForChildren(), + isClean()); + oldKeys_ = null; + } + return oldKeysBuilder_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column keys = 6; + private java.util.List keys_ = + java.util.Collections.emptyList(); + private void ensureKeysIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + keys_ = new java.util.ArrayList(keys_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> keysBuilder_; + + public java.util.List getKeysList() { + if (keysBuilder_ == null) { + return java.util.Collections.unmodifiableList(keys_); + } else { + return keysBuilder_.getMessageList(); + } + } + public int getKeysCount() { + if (keysBuilder_ == null) { + return keys_.size(); + } else { + return keysBuilder_.getCount(); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getKeys(int index) { + if (keysBuilder_ == null) { + return keys_.get(index); + } else { + return keysBuilder_.getMessage(index); + } + } + public Builder setKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.set(index, value); + onChanged(); + } else { + keysBuilder_.setMessage(index, value); + } + return this; + } + public Builder setKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.set(index, builderForValue.build()); + onChanged(); + } else { + keysBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addKeys(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + } else { + keysBuilder_.addMessage(value); + } + return this; + } + public Builder addKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(index, value); + onChanged(); + } else { + keysBuilder_.addMessage(index, value); + } + return this; + } + public Builder addKeys( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.add(builderForValue.build()); + onChanged(); + } else { + keysBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addKeys( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.add(index, builderForValue.build()); + onChanged(); + } else { + keysBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllKeys( + java.lang.Iterable values) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + super.addAll(values, keys_); + onChanged(); + } else { + keysBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearKeys() { + if (keysBuilder_ == null) { + keys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + keysBuilder_.clear(); + } + return this; + } + public Builder removeKeys(int index) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.remove(index); + onChanged(); + } else { + keysBuilder_.remove(index); + } + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getKeysBuilder( + int index) { + return getKeysFieldBuilder().getBuilder(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getKeysOrBuilder( + int index) { + if (keysBuilder_ == null) { + return keys_.get(index); } else { + return keysBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getKeysOrBuilderList() { + if (keysBuilder_ != null) { + return keysBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(keys_); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addKeysBuilder() { + return getKeysFieldBuilder().addBuilder( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addKeysBuilder( + int index) { + return getKeysFieldBuilder().addBuilder( + index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public java.util.List + getKeysBuilderList() { + return getKeysFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> + getKeysFieldBuilder() { + if (keysBuilder_ == null) { + keysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder>( + keys_, + ((bitField0_ & 0x00000020) == 0x00000020), + getParentForChildren(), + isClean()); + keys_ = null; + } + return keysBuilder_; + } + + // repeated .com.alibaba.otter.node.etl.model.protobuf.Column columns = 7; + private java.util.List columns_ = + java.util.Collections.emptyList(); + private void ensureColumnsIsMutable() { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { + columns_ = new java.util.ArrayList(columns_); + bitField0_ |= 0x00000040; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> columnsBuilder_; + + public java.util.List getColumnsList() { + if (columnsBuilder_ == null) { + return java.util.Collections.unmodifiableList(columns_); + } else { + return columnsBuilder_.getMessageList(); + } + } + public int getColumnsCount() { + if (columnsBuilder_ == null) { + return columns_.size(); + } else { + return columnsBuilder_.getCount(); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getColumns(int index) { + if (columnsBuilder_ == null) { + return columns_.get(index); + } else { + return columnsBuilder_.getMessage(index); + } + } + public Builder setColumns( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (columnsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsIsMutable(); + columns_.set(index, value); + onChanged(); + } else { + columnsBuilder_.setMessage(index, value); + } + return this; + } + public Builder setColumns( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (columnsBuilder_ == null) { + ensureColumnsIsMutable(); + columns_.set(index, builderForValue.build()); + onChanged(); + } else { + columnsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + public Builder addColumns(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (columnsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsIsMutable(); + columns_.add(value); + onChanged(); + } else { + columnsBuilder_.addMessage(value); + } + return this; + } + public Builder addColumns( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column value) { + if (columnsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureColumnsIsMutable(); + columns_.add(index, value); + onChanged(); + } else { + columnsBuilder_.addMessage(index, value); + } + return this; + } + public Builder addColumns( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (columnsBuilder_ == null) { + ensureColumnsIsMutable(); + columns_.add(builderForValue.build()); + onChanged(); + } else { + columnsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + public Builder addColumns( + int index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder builderForValue) { + if (columnsBuilder_ == null) { + ensureColumnsIsMutable(); + columns_.add(index, builderForValue.build()); + onChanged(); + } else { + columnsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + public Builder addAllColumns( + java.lang.Iterable values) { + if (columnsBuilder_ == null) { + ensureColumnsIsMutable(); + super.addAll(values, columns_); + onChanged(); + } else { + columnsBuilder_.addAllMessages(values); + } + return this; + } + public Builder clearColumns() { + if (columnsBuilder_ == null) { + columns_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); + onChanged(); + } else { + columnsBuilder_.clear(); + } + return this; + } + public Builder removeColumns(int index) { + if (columnsBuilder_ == null) { + ensureColumnsIsMutable(); + columns_.remove(index); + onChanged(); + } else { + columnsBuilder_.remove(index); + } + return this; + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder getColumnsBuilder( + int index) { + return getColumnsFieldBuilder().getBuilder(index); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder getColumnsOrBuilder( + int index) { + if (columnsBuilder_ == null) { + return columns_.get(index); } else { + return columnsBuilder_.getMessageOrBuilder(index); + } + } + public java.util.List + getColumnsOrBuilderList() { + if (columnsBuilder_ != null) { + return columnsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(columns_); + } + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addColumnsBuilder() { + return getColumnsFieldBuilder().addBuilder( + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder addColumnsBuilder( + int index) { + return getColumnsFieldBuilder().addBuilder( + index, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()); + } + public java.util.List + getColumnsBuilderList() { + return getColumnsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder> + getColumnsFieldBuilder() { + if (columnsBuilder_ == null) { + columnsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column, com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder, com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder>( + columns_, + ((bitField0_ & 0x00000040) == 0x00000040), + getParentForChildren(), + isClean()); + columns_ = null; + } + return columnsBuilder_; + } + + // optional int64 executeTime = 8; + private long executeTime_ ; + public boolean hasExecuteTime() { + return ((bitField0_ & 0x00000080) == 0x00000080); + } + public long getExecuteTime() { + return executeTime_; + } + public Builder setExecuteTime(long value) { + bitField0_ |= 0x00000080; + executeTime_ = value; + onChanged(); + return this; + } + public Builder clearExecuteTime() { + bitField0_ = (bitField0_ & ~0x00000080); + executeTime_ = 0L; + onChanged(); + return this; + } + + // optional int64 pairId = 9; + private long pairId_ ; + public boolean hasPairId() { + return ((bitField0_ & 0x00000100) == 0x00000100); + } + public long getPairId() { + return pairId_; + } + public Builder setPairId(long value) { + bitField0_ |= 0x00000100; + pairId_ = value; + onChanged(); + return this; + } + public Builder clearPairId() { + bitField0_ = (bitField0_ & ~0x00000100); + pairId_ = 0L; + onChanged(); + return this; + } + + // optional string syncMode = 10; + private java.lang.Object syncMode_ = ""; + public boolean hasSyncMode() { + return ((bitField0_ & 0x00000200) == 0x00000200); + } + public String getSyncMode() { + java.lang.Object ref = syncMode_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + syncMode_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setSyncMode(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000200; + syncMode_ = value; + onChanged(); + return this; + } + public Builder clearSyncMode() { + bitField0_ = (bitField0_ & ~0x00000200); + syncMode_ = getDefaultInstance().getSyncMode(); + onChanged(); + return this; + } + void setSyncMode(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000200; + syncMode_ = value; + onChanged(); + } + + // optional string syncConsistency = 11; + private java.lang.Object syncConsistency_ = ""; + public boolean hasSyncConsistency() { + return ((bitField0_ & 0x00000400) == 0x00000400); + } + public String getSyncConsistency() { + java.lang.Object ref = syncConsistency_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + syncConsistency_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setSyncConsistency(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000400; + syncConsistency_ = value; + onChanged(); + return this; + } + public Builder clearSyncConsistency() { + bitField0_ = (bitField0_ & ~0x00000400); + syncConsistency_ = getDefaultInstance().getSyncConsistency(); + onChanged(); + return this; + } + void setSyncConsistency(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000400; + syncConsistency_ = value; + onChanged(); + } + + // optional int64 size = 12; + private long size_ ; + public boolean hasSize() { + return ((bitField0_ & 0x00000800) == 0x00000800); + } + public long getSize() { + return size_; + } + public Builder setSize(long value) { + bitField0_ |= 0x00000800; + size_ = value; + onChanged(); + return this; + } + public Builder clearSize() { + bitField0_ = (bitField0_ & ~0x00000800); + size_ = 0L; + onChanged(); + return this; + } + + // optional bool remedy = 13; + private boolean remedy_ ; + public boolean hasRemedy() { + return ((bitField0_ & 0x00001000) == 0x00001000); + } + public boolean getRemedy() { + return remedy_; + } + public Builder setRemedy(boolean value) { + bitField0_ |= 0x00001000; + remedy_ = value; + onChanged(); + return this; + } + public Builder clearRemedy() { + bitField0_ = (bitField0_ & ~0x00001000); + remedy_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.RowData) + } + + static { + defaultInstance = new RowData(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.RowData) + } + + public interface ColumnOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional int32 index = 1; + boolean hasIndex(); + int getIndex(); + + // optional string name = 2; + boolean hasName(); + String getName(); + + // optional string value = 3; + boolean hasValue(); + String getValue(); + + // optional bool isPrimaryKey = 4; + boolean hasIsPrimaryKey(); + boolean getIsPrimaryKey(); + + // optional bool isNull = 5; + boolean hasIsNull(); + boolean getIsNull(); + + // optional int32 type = 6; + boolean hasType(); + int getType(); + + // optional bool isUpdate = 7; + boolean hasIsUpdate(); + boolean getIsUpdate(); + } + public static final class Column extends + com.google.protobuf.GeneratedMessage + implements ColumnOrBuilder { + // Use Column.newBuilder() to construct. + private Column(Builder builder) { + super(builder); + } + private Column(boolean noInit) {} + + private static final Column defaultInstance; + public static Column getDefaultInstance() { + return defaultInstance; + } + + public Column getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; + } + + private int bitField0_; + // optional int32 index = 1; + public static final int INDEX_FIELD_NUMBER = 1; + private int index_; + public boolean hasIndex() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getIndex() { + return index_; + } + + // optional string name = 2; + public static final int NAME_FIELD_NUMBER = 2; + private java.lang.Object name_; + public boolean hasName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getName() { + java.lang.Object ref = name_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + name_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string value = 3; + public static final int VALUE_FIELD_NUMBER = 3; + private java.lang.Object value_; + public boolean hasValue() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getValue() { + java.lang.Object ref = value_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + value_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bool isPrimaryKey = 4; + public static final int ISPRIMARYKEY_FIELD_NUMBER = 4; + private boolean isPrimaryKey_; + public boolean hasIsPrimaryKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getIsPrimaryKey() { + return isPrimaryKey_; + } + + // optional bool isNull = 5; + public static final int ISNULL_FIELD_NUMBER = 5; + private boolean isNull_; + public boolean hasIsNull() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIsNull() { + return isNull_; + } + + // optional int32 type = 6; + public static final int TYPE_FIELD_NUMBER = 6; + private int type_; + public boolean hasType() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public int getType() { + return type_; + } + + // optional bool isUpdate = 7; + public static final int ISUPDATE_FIELD_NUMBER = 7; + private boolean isUpdate_; + public boolean hasIsUpdate() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getIsUpdate() { + return isUpdate_; + } + + private void initFields() { + index_ = 0; + name_ = ""; + value_ = ""; + isPrimaryKey_ = false; + isNull_ = false; + type_ = 0; + isUpdate_ = false; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeInt32(1, index_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getValueBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBool(4, isPrimaryKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBool(5, isNull_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt32(6, type_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeBool(7, isUpdate_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, index_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getNameBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getValueBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, isPrimaryKey_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, isNull_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(6, type_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(7, isUpdate_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.ColumnOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + index_ = 0; + bitField0_ = (bitField0_ & ~0x00000001); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + value_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + isPrimaryKey_ = false; + bitField0_ = (bitField0_ & ~0x00000008); + isNull_ = false; + bitField0_ = (bitField0_ & ~0x00000010); + type_ = 0; + bitField0_ = (bitField0_ & ~0x00000020); + isUpdate_ = false; + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.index_ = index_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.name_ = name_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.value_ = value_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.isPrimaryKey_ = isPrimaryKey_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.isNull_ = isNull_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.isUpdate_ = isUpdate_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.getDefaultInstance()) return this; + if (other.hasIndex()) { + setIndex(other.getIndex()); + } + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasValue()) { + setValue(other.getValue()); + } + if (other.hasIsPrimaryKey()) { + setIsPrimaryKey(other.getIsPrimaryKey()); + } + if (other.hasIsNull()) { + setIsNull(other.getIsNull()); + } + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasIsUpdate()) { + setIsUpdate(other.getIsUpdate()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); onChanged(); return this; - } - - // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.FileData) - } - - static { - defaultInstance = new FileData(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.FileData) + } + break; + } + case 8: { + bitField0_ |= 0x00000001; + index_ = input.readInt32(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + name_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + value_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + isPrimaryKey_ = input.readBool(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + isNull_ = input.readBool(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + type_ = input.readInt32(); + break; + } + case 56: { + bitField0_ |= 0x00000040; + isUpdate_ = input.readBool(); + break; + } + } + } + } + + private int bitField0_; + + // optional int32 index = 1; + private int index_ ; + public boolean hasIndex() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public int getIndex() { + return index_; + } + public Builder setIndex(int value) { + bitField0_ |= 0x00000001; + index_ = value; + onChanged(); + return this; + } + public Builder clearIndex() { + bitField0_ = (bitField0_ & ~0x00000001); + index_ = 0; + onChanged(); + return this; + } + + // optional string name = 2; + private java.lang.Object name_ = ""; + public boolean hasName() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + name_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setName(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + name_ = value; + onChanged(); + return this; + } + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000002); + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + void setName(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + name_ = value; + onChanged(); + } + + // optional string value = 3; + private java.lang.Object value_ = ""; + public boolean hasValue() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + value_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setValue(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + value_ = value; + onChanged(); + return this; + } + public Builder clearValue() { + bitField0_ = (bitField0_ & ~0x00000004); + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + void setValue(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + value_ = value; + onChanged(); + } + + // optional bool isPrimaryKey = 4; + private boolean isPrimaryKey_ ; + public boolean hasIsPrimaryKey() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public boolean getIsPrimaryKey() { + return isPrimaryKey_; + } + public Builder setIsPrimaryKey(boolean value) { + bitField0_ |= 0x00000008; + isPrimaryKey_ = value; + onChanged(); + return this; + } + public Builder clearIsPrimaryKey() { + bitField0_ = (bitField0_ & ~0x00000008); + isPrimaryKey_ = false; + onChanged(); + return this; + } + + // optional bool isNull = 5; + private boolean isNull_ ; + public boolean hasIsNull() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public boolean getIsNull() { + return isNull_; + } + public Builder setIsNull(boolean value) { + bitField0_ |= 0x00000010; + isNull_ = value; + onChanged(); + return this; + } + public Builder clearIsNull() { + bitField0_ = (bitField0_ & ~0x00000010); + isNull_ = false; + onChanged(); + return this; + } + + // optional int32 type = 6; + private int type_ ; + public boolean hasType() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public int getType() { + return type_; + } + public Builder setType(int value) { + bitField0_ |= 0x00000020; + type_ = value; + onChanged(); + return this; + } + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000020); + type_ = 0; + onChanged(); + return this; + } + + // optional bool isUpdate = 7; + private boolean isUpdate_ ; + public boolean hasIsUpdate() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public boolean getIsUpdate() { + return isUpdate_; + } + public Builder setIsUpdate(boolean value) { + bitField0_ |= 0x00000040; + isUpdate_ = value; + onChanged(); + return this; + } + public Builder clearIsUpdate() { + bitField0_ = (bitField0_ & ~0x00000040); + isUpdate_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.Column) } - - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; - private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { - return descriptor; + + static { + defaultInstance = new Column(true); + defaultInstance.initFields(); } - - private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.Column) + } + + public interface FileDataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // optional string eventType = 1; + boolean hasEventType(); + String getEventType(); + + // optional string namespace = 2; + boolean hasNamespace(); + String getNamespace(); + + // optional string path = 3; + boolean hasPath(); + String getPath(); + + // optional int64 lastModifiedTime = 4; + boolean hasLastModifiedTime(); + long getLastModifiedTime(); + + // optional int64 size = 5; + boolean hasSize(); + long getSize(); + + // optional int64 tableId = 6; + boolean hasTableId(); + long getTableId(); + + // optional int64 pairId = 9; + boolean hasPairId(); + long getPairId(); + } + public static final class FileData extends + com.google.protobuf.GeneratedMessage + implements FileDataOrBuilder { + // Use FileData.newBuilder() to construct. + private FileData(Builder builder) { + super(builder); + } + private FileData(boolean noInit) {} + + private static final FileData defaultInstance; + public static FileData getDefaultInstance() { + return defaultInstance; + } + + public FileData getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; + } + + private int bitField0_; + // optional string eventType = 1; + public static final int EVENTTYPE_FIELD_NUMBER = 1; + private java.lang.Object eventType_; + public boolean hasEventType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getEventType() { + java.lang.Object ref = eventType_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + eventType_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getEventTypeBytes() { + java.lang.Object ref = eventType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + eventType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string namespace = 2; + public static final int NAMESPACE_FIELD_NUMBER = 2; + private java.lang.Object namespace_; + public boolean hasNamespace() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getNamespace() { + java.lang.Object ref = namespace_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + namespace_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getNamespaceBytes() { + java.lang.Object ref = namespace_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + namespace_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional string path = 3; + public static final int PATH_FIELD_NUMBER = 3; + private java.lang.Object path_; + public boolean hasPath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional int64 lastModifiedTime = 4; + public static final int LASTMODIFIEDTIME_FIELD_NUMBER = 4; + private long lastModifiedTime_; + public boolean hasLastModifiedTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getLastModifiedTime() { + return lastModifiedTime_; + } + + // optional int64 size = 5; + public static final int SIZE_FIELD_NUMBER = 5; + private long size_; + public boolean hasSize() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getSize() { + return size_; + } + + // optional int64 tableId = 6; + public static final int TABLEID_FIELD_NUMBER = 6; + private long tableId_; + public boolean hasTableId() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getTableId() { + return tableId_; + } + + // optional int64 pairId = 9; + public static final int PAIRID_FIELD_NUMBER = 9; + private long pairId_; + public boolean hasPairId() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public long getPairId() { + return pairId_; + } + + private void initFields() { + eventType_ = ""; + namespace_ = ""; + path_ = ""; + lastModifiedTime_ = 0L; + size_ = 0L; + tableId_ = 0L; + pairId_ = 0L; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getEventTypeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getNamespaceBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getPathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt64(4, lastModifiedTime_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt64(5, size_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + output.writeInt64(6, tableId_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + output.writeInt64(9, pairId_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getEventTypeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getNamespaceBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getPathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(4, lastModifiedTime_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(5, size_); + } + if (((bitField0_ & 0x00000020) == 0x00000020)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(6, tableId_); + } + if (((bitField0_ & 0x00000040) == 0x00000040)) { + size += com.google.protobuf.CodedOutputStream + .computeInt64Size(9, pairId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; + } + + // Construct using com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + eventType_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + namespace_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + lastModifiedTime_ = 0L; + bitField0_ = (bitField0_ & ~0x00000008); + size_ = 0L; + bitField0_ = (bitField0_ & ~0x00000010); + tableId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000020); + pairId_ = 0L; + bitField0_ = (bitField0_ & ~0x00000040); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDescriptor(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData getDefaultInstanceForType() { + return com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance(); + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData build() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData buildPartial() { + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData result = new com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.eventType_ = eventType_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.namespace_ = namespace_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.lastModifiedTime_ = lastModifiedTime_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.size_ = size_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000020; + } + result.tableId_ = tableId_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000040; + } + result.pairId_ = pairId_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData) { + return mergeFrom((com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData other) { + if (other == com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.getDefaultInstance()) return this; + if (other.hasEventType()) { + setEventType(other.getEventType()); + } + if (other.hasNamespace()) { + setNamespace(other.getNamespace()); + } + if (other.hasPath()) { + setPath(other.getPath()); + } + if (other.hasLastModifiedTime()) { + setLastModifiedTime(other.getLastModifiedTime()); + } + if (other.hasSize()) { + setSize(other.getSize()); + } + if (other.hasTableId()) { + setTableId(other.getTableId()); + } + if (other.hasPairId()) { + setPairId(other.getPairId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + eventType_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + namespace_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + path_ = input.readBytes(); + break; + } + case 32: { + bitField0_ |= 0x00000008; + lastModifiedTime_ = input.readInt64(); + break; + } + case 40: { + bitField0_ |= 0x00000010; + size_ = input.readInt64(); + break; + } + case 48: { + bitField0_ |= 0x00000020; + tableId_ = input.readInt64(); + break; + } + case 72: { + bitField0_ |= 0x00000040; + pairId_ = input.readInt64(); + break; + } + } + } + } + + private int bitField0_; + + // optional string eventType = 1; + private java.lang.Object eventType_ = ""; + public boolean hasEventType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getEventType() { + java.lang.Object ref = eventType_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + eventType_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setEventType(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + eventType_ = value; + onChanged(); + return this; + } + public Builder clearEventType() { + bitField0_ = (bitField0_ & ~0x00000001); + eventType_ = getDefaultInstance().getEventType(); + onChanged(); + return this; + } + void setEventType(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + eventType_ = value; + onChanged(); + } + + // optional string namespace = 2; + private java.lang.Object namespace_ = ""; + public boolean hasNamespace() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public String getNamespace() { + java.lang.Object ref = namespace_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + namespace_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setNamespace(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + namespace_ = value; + onChanged(); + return this; + } + public Builder clearNamespace() { + bitField0_ = (bitField0_ & ~0x00000002); + namespace_ = getDefaultInstance().getNamespace(); + onChanged(); + return this; + } + void setNamespace(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000002; + namespace_ = value; + onChanged(); + } + + // optional string path = 3; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000004); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + } + + // optional int64 lastModifiedTime = 4; + private long lastModifiedTime_ ; + public boolean hasLastModifiedTime() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public long getLastModifiedTime() { + return lastModifiedTime_; + } + public Builder setLastModifiedTime(long value) { + bitField0_ |= 0x00000008; + lastModifiedTime_ = value; + onChanged(); + return this; + } + public Builder clearLastModifiedTime() { + bitField0_ = (bitField0_ & ~0x00000008); + lastModifiedTime_ = 0L; + onChanged(); + return this; + } + + // optional int64 size = 5; + private long size_ ; + public boolean hasSize() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public long getSize() { + return size_; + } + public Builder setSize(long value) { + bitField0_ |= 0x00000010; + size_ = value; + onChanged(); + return this; + } + public Builder clearSize() { + bitField0_ = (bitField0_ & ~0x00000010); + size_ = 0L; + onChanged(); + return this; + } + + // optional int64 tableId = 6; + private long tableId_ ; + public boolean hasTableId() { + return ((bitField0_ & 0x00000020) == 0x00000020); + } + public long getTableId() { + return tableId_; + } + public Builder setTableId(long value) { + bitField0_ |= 0x00000020; + tableId_ = value; + onChanged(); + return this; + } + public Builder clearTableId() { + bitField0_ = (bitField0_ & ~0x00000020); + tableId_ = 0L; + onChanged(); + return this; + } + + // optional int64 pairId = 9; + private long pairId_ ; + public boolean hasPairId() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + public long getPairId() { + return pairId_; + } + public Builder setPairId(long value) { + bitField0_ |= 0x00000040; + pairId_ = value; + onChanged(); + return this; + } + public Builder clearPairId() { + bitField0_ = (bitField0_ & ~0x00000040); + pairId_ = 0L; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:com.alibaba.otter.node.etl.model.protobuf.FileData) + } + static { - java.lang.String[] descriptorData = { - "\n\013Batch.proto\022)com.alibaba.otter.node.et" + "l.model.protobuf\"D\n\010Identity\022\021\n\tchannelI" - + "d\030\001 \001(\003\022\022\n\npipelineId\030\002 \001(\003\022\021\n\tprocessId" - + "\030\003 \001(\003\"\223\001\n\010RowBatch\022E\n\010identity\030\001 \001(\01323." - + "com.alibaba.otter.node.etl.model.protobu" - + "f.Identity\022@\n\004rows\030\002 \003(\01322.com.alibaba.o" - + "tter.node.etl.model.protobuf.RowData\"\226\001\n" - + "\tFileBatch\022E\n\010identity\030\001 \001(\01323.com.aliba" - + "ba.otter.node.etl.model.protobuf.Identit" - + "y\022B\n\005files\030\002 \003(\01323.com.alibaba.otter.nod", - "e.etl.model.protobuf.FileData\"\213\003\n\007RowDat" - + "a\022\017\n\007tableId\030\001 \001(\003\022\022\n\nschemaName\030\002 \001(\t\022\021" - + "\n\ttableName\030\003 \001(\t\022\021\n\teventType\030\004 \001(\t\022B\n\007" - + "oldKeys\030\005 \003(\01321.com.alibaba.otter.node.e" - + "tl.model.protobuf.Column\022?\n\004keys\030\006 \003(\01321" - + ".com.alibaba.otter.node.etl.model.protob" - + "uf.Column\022B\n\007columns\030\007 \003(\01321.com.alibaba" - + ".otter.node.etl.model.protobuf.Column\022\023\n" - + "\013executeTime\030\010 \001(\003\022\016\n\006pairId\030\t \001(\003\022\020\n\010sy" - + "ncMode\030\n \001(\t\022\027\n\017syncConsistency\030\013 \001(\t\022\014\n", - "\004size\030\014 \001(\003\022\016\n\006remedy\030\r \001(\010\"z\n\006Column\022\r\n" - + "\005index\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\r\n\005value\030\003 \001(" - + "\t\022\024\n\014isPrimaryKey\030\004 \001(\010\022\016\n\006isNull\030\005 \001(\010\022" - + "\014\n\004type\030\006 \001(\005\022\020\n\010isUpdate\030\007 \001(\010\"\207\001\n\010File" - + "Data\022\021\n\teventType\030\001 \001(\t\022\021\n\tnamespace\030\002 \001" - + "(\t\022\014\n\004path\030\003 \001(\t\022\030\n\020lastModifiedTime\030\004 \001" - + "(\003\022\014\n\004size\030\005 \001(\003\022\017\n\007tableId\030\006 \001(\003\022\016\n\006pai" - + "rId\030\t \001(\003B\016B\nBatchProtoH\001" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - - public com.google.protobuf.ExtensionRegistry assignDescriptors(com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor, - new java.lang.String[] { - "ChannelId", "PipelineId", "ProcessId", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder.class); - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor = getDescriptor().getMessageTypes().get(1); - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor, - new java.lang.String[] { - "Identity", "Rows", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.Builder.class); - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor = getDescriptor().getMessageTypes().get(2); - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor, - new java.lang.String[] { - "Identity", "Files", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.Builder.class); - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor = getDescriptor().getMessageTypes().get(3); - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor, - new java.lang.String[] { - "TableId", "SchemaName", "TableName", "EventType", "OldKeys", "Keys", "Columns", "ExecuteTime", "PairId", - "SyncMode", "SyncConsistency", "Size", "Remedy", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder.class); - internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor = getDescriptor().getMessageTypes().get(4); - internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor, - new java.lang.String[] { - "Index", "Name", "Value", "IsPrimaryKey", "IsNull", "Type", "IsUpdate", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder.class); - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor = getDescriptor().getMessageTypes().get(5); - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor, - new java.lang.String[] { - "EventType", "Namespace", "Path", "LastModifiedTime", "Size", "TableId", "PairId", }, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.class, - com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder.class); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] {}, - assigner); + defaultInstance = new FileData(true); + defaultInstance.initFields(); } - - // @@protoc_insertion_point(outer_class_scope) + + // @@protoc_insertion_point(class_scope:com.alibaba.otter.node.etl.model.protobuf.FileData) + } + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\013Batch.proto\022)com.alibaba.otter.node.et" + + "l.model.protobuf\"D\n\010Identity\022\021\n\tchannelI" + + "d\030\001 \001(\003\022\022\n\npipelineId\030\002 \001(\003\022\021\n\tprocessId" + + "\030\003 \001(\003\"\223\001\n\010RowBatch\022E\n\010identity\030\001 \001(\01323." + + "com.alibaba.otter.node.etl.model.protobu" + + "f.Identity\022@\n\004rows\030\002 \003(\01322.com.alibaba.o" + + "tter.node.etl.model.protobuf.RowData\"\226\001\n" + + "\tFileBatch\022E\n\010identity\030\001 \001(\01323.com.aliba" + + "ba.otter.node.etl.model.protobuf.Identit" + + "y\022B\n\005files\030\002 \003(\01323.com.alibaba.otter.nod", + "e.etl.model.protobuf.FileData\"\213\003\n\007RowDat" + + "a\022\017\n\007tableId\030\001 \001(\003\022\022\n\nschemaName\030\002 \001(\t\022\021" + + "\n\ttableName\030\003 \001(\t\022\021\n\teventType\030\004 \001(\t\022B\n\007" + + "oldKeys\030\005 \003(\01321.com.alibaba.otter.node.e" + + "tl.model.protobuf.Column\022?\n\004keys\030\006 \003(\01321" + + ".com.alibaba.otter.node.etl.model.protob" + + "uf.Column\022B\n\007columns\030\007 \003(\01321.com.alibaba" + + ".otter.node.etl.model.protobuf.Column\022\023\n" + + "\013executeTime\030\010 \001(\003\022\016\n\006pairId\030\t \001(\003\022\020\n\010sy" + + "ncMode\030\n \001(\t\022\027\n\017syncConsistency\030\013 \001(\t\022\014\n", + "\004size\030\014 \001(\003\022\016\n\006remedy\030\r \001(\010\"z\n\006Column\022\r\n" + + "\005index\030\001 \001(\005\022\014\n\004name\030\002 \001(\t\022\r\n\005value\030\003 \001(" + + "\t\022\024\n\014isPrimaryKey\030\004 \001(\010\022\016\n\006isNull\030\005 \001(\010\022" + + "\014\n\004type\030\006 \001(\005\022\020\n\010isUpdate\030\007 \001(\010\"\207\001\n\010File" + + "Data\022\021\n\teventType\030\001 \001(\t\022\021\n\tnamespace\030\002 \001" + + "(\t\022\014\n\004path\030\003 \001(\t\022\030\n\020lastModifiedTime\030\004 \001" + + "(\003\022\014\n\004size\030\005 \001(\003\022\017\n\007tableId\030\006 \001(\003\022\016\n\006pai" + + "rId\030\t \001(\003B\016B\nBatchProtoH\001" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_Identity_descriptor, + new java.lang.String[] { "ChannelId", "PipelineId", "ProcessId", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Identity.Builder.class); + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowBatch_descriptor, + new java.lang.String[] { "Identity", "Rows", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowBatch.Builder.class); + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileBatch_descriptor, + new java.lang.String[] { "Identity", "Files", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileBatch.Builder.class); + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_RowData_descriptor, + new java.lang.String[] { "TableId", "SchemaName", "TableName", "EventType", "OldKeys", "Keys", "Columns", "ExecuteTime", "PairId", "SyncMode", "SyncConsistency", "Size", "Remedy", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.RowData.Builder.class); + internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_Column_descriptor, + new java.lang.String[] { "Index", "Name", "Value", "IsPrimaryKey", "IsNull", "Type", "IsUpdate", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.Column.Builder.class); + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_com_alibaba_otter_node_etl_model_protobuf_FileData_descriptor, + new java.lang.String[] { "EventType", "Namespace", "Path", "LastModifiedTime", "Size", "TableId", "PairId", }, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.class, + com.alibaba.otter.node.etl.model.protobuf.BatchProto.FileData.Builder.class); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + } + + // @@protoc_insertion_point(outer_class_scope) } diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/SelectTask.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/SelectTask.java index 900517a7..f041a31c 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/SelectTask.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/SelectTask.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select; import java.util.Date; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/exceptions/SelectException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/exceptions/SelectException.java index e909e6e6..25142bdb 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/exceptions/SelectException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/exceptions/SelectException.java @@ -1,27 +1,41 @@ -package com.alibaba.otter.node.etl.select.exceptions; - -/** - * SelectException for select module. - * - * @author xiaoqing.zhouxq - */ -public class SelectException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public SelectException(String cause){ - super(cause); - } - - public SelectException(Throwable t){ - super(t); - } - - public SelectException(String cause, Throwable t){ - super(cause, t); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.select.exceptions; + +/** + * SelectException for select module. + * + * @author xiaoqing.zhouxq + */ +public class SelectException extends RuntimeException { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public SelectException(String cause){ + super(cause); + } + + public SelectException(Throwable t){ + super(t); + } + + public SelectException(String cause, Throwable t){ + super(cause, t); + } + +} diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/Message.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/Message.java index 031a606c..78a4d260 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/Message.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/Message.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageDumper.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageDumper.java index 2d215fa8..dca46832 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageDumper.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageDumper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector; import java.text.MessageFormat; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java index 1a4cebbf..33a37b7e 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector; import java.util.ArrayList; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelector.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelector.java index 9b0dd4f6..cd80bffc 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelector.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelector.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelectorFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelectorFactory.java index 54266e5f..b38e9d14 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelectorFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/OtterSelectorFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector; import com.alibaba.otter.node.etl.OtterContextLocator; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/CanalEmbedSelector.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/CanalEmbedSelector.java index da622463..7983d943 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/CanalEmbedSelector.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/CanalEmbedSelector.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector.canal; import java.text.SimpleDateFormat; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterAlarmHandler.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterAlarmHandler.java index b75eeebf..d2d31399 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterAlarmHandler.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterAlarmHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector.canal; import com.alibaba.otter.canal.common.AbstractCanalLifeCycle; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterDownStreamHandler.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterDownStreamHandler.java index 0ff7436c..8e410954 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterDownStreamHandler.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/canal/OtterDownStreamHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select.selector.canal; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/TransformTask.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/TransformTask.java index 4935a63c..bea21254 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/TransformTask.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/TransformTask.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform; import java.util.List; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/exception/TransformException.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/exception/TransformException.java index 57727400..fa86ef84 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/exception/TransformException.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/exception/TransformException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/AbstractOtterTransformer.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/AbstractOtterTransformer.java index f76c8509..fb0233d7 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/AbstractOtterTransformer.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/AbstractOtterTransformer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/FileDataTransformer.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/FileDataTransformer.java index 20b3cbd8..dff5112a 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/FileDataTransformer.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/FileDataTransformer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; import com.alibaba.otter.shared.etl.model.FileData; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformer.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformer.java index 0b6f9b73..9987419b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformer.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; /** diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerContext.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerContext.java index 65b1b2cc..ca4bec4c 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerContext.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; import com.alibaba.otter.shared.common.model.config.data.DataMediaPair; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerFactory.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerFactory.java index e0edfcc9..4c17807b 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerFactory.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/OtterTransformerFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; import java.util.HashMap; diff --git a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java index ad4a2f30..e3aedcd3 100644 --- a/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java +++ b/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform.transformer; import java.util.ArrayList; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/ArbitrateRemoteServiceIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/ArbitrateRemoteServiceIntegration.java index 2e403077..a6ee18da 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/ArbitrateRemoteServiceIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/ArbitrateRemoteServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; import java.util.concurrent.TimeUnit; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseDbTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseDbTest.java index 6cf3e31f..b079df98 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseDbTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseDbTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; import com.alibaba.otter.shared.common.model.config.data.DataMediaType; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseOtterTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseOtterTest.java index e2c59c70..5566d3e6 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseOtterTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; import org.jtester.annotations.SpringApplicationContext; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/TestUtils.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/TestUtils.java index b8792f22..74f3b80c 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/TestUtils.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/TestUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl; import java.lang.management.ManagementFactory; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/AbstractDbDialectTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/AbstractDbDialectTest.java index ef311054..ec040ef1 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/AbstractDbDialectTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/AbstractDbDialectTest.java @@ -1,68 +1,82 @@ -package com.alibaba.otter.node.etl.common.datasource; - -import javax.sql.DataSource; - -import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.lang.StringUtils; -import org.apache.ddlutils.model.Column; -import org.apache.ddlutils.model.Table; -import org.springframework.jdbc.core.JdbcTemplate; -import org.testng.annotations.Test; - -import com.alibaba.otter.shared.common.model.config.data.DataMediaType; -import com.alibaba.otter.shared.common.utils.meta.DdlUtils; - -/** - * 类TestAbstractDbDialect.java的实现描述:TODO 类实现描述 - * - * @author xiaoqing.zhouxq 2011-12-9 下午3:03:55 - */ -public class AbstractDbDialectTest { - - @Test - public void testFindTable() throws Exception { - DataSource dataSource = createDataSource("jdbc:oracle:thin:@10.20.144.25:1521:OINTEST", "otter1", "jonathan", - "oracle.jdbc.OracleDriver", DataMediaType.ORACLE, "utf-8"); - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); - Table table = DdlUtils.findTable(jdbcTemplate, "otter1".toUpperCase(), "otter1".toUpperCase(), - "wytable3".toUpperCase()); - System.out.println("the tablename = " + table.getSchema() + "." + table.getName()); - Column[] columns = table.getColumns(); - for (Column column : columns) { - System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() - + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); - } - - } - - private DataSource createDataSource(String url, String userName, String password, String driverClassName, - DataMediaType dataMediaType, String encoding) { - BasicDataSource dbcpDs = new BasicDataSource(); - - dbcpDs.setRemoveAbandoned(true); - dbcpDs.setLogAbandoned(true); - dbcpDs.setTestOnBorrow(true); - dbcpDs.setTestWhileIdle(true); - - // 动态的参数 - dbcpDs.setDriverClassName(driverClassName); - dbcpDs.setUrl(url); - dbcpDs.setUsername(userName); - dbcpDs.setPassword(password); - - if (dataMediaType.isOracle()) { - dbcpDs.addConnectionProperty("restrictGetTables", "true"); - dbcpDs.setValidationQuery("select 1 from dual"); - } else if (dataMediaType.isMysql()) { - // open the batch mode for mysql since 5.1.8 - dbcpDs.addConnectionProperty("useServerPrepStmts", "true"); - dbcpDs.addConnectionProperty("rewriteBatchedStatements", "true"); - if (StringUtils.isNotEmpty(encoding)) { - dbcpDs.addConnectionProperty("characterEncoding", encoding); - } - dbcpDs.setValidationQuery("select 1"); - } - - return dbcpDs; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.datasource; + +import javax.sql.DataSource; + +import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.lang.StringUtils; +import org.apache.ddlutils.model.Column; +import org.apache.ddlutils.model.Table; +import org.springframework.jdbc.core.JdbcTemplate; +import org.testng.annotations.Test; + +import com.alibaba.otter.shared.common.model.config.data.DataMediaType; +import com.alibaba.otter.shared.common.utils.meta.DdlUtils; + +/** + * 类TestAbstractDbDialect.java的实现描述:TODO 类实现描述 + * + * @author xiaoqing.zhouxq 2011-12-9 下午3:03:55 + */ +public class AbstractDbDialectTest { + + @Test + public void testFindTable() throws Exception { + DataSource dataSource = createDataSource("jdbc:oracle:thin:@10.20.144.25:1521:OINTEST", "otter1", "jonathan", + "oracle.jdbc.OracleDriver", DataMediaType.ORACLE, "utf-8"); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); + Table table = DdlUtils.findTable(jdbcTemplate, "otter1".toUpperCase(), "otter1".toUpperCase(), + "wytable3".toUpperCase()); + System.out.println("the tablename = " + table.getSchema() + "." + table.getName()); + Column[] columns = table.getColumns(); + for (Column column : columns) { + System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() + + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); + } + + } + + private DataSource createDataSource(String url, String userName, String password, String driverClassName, + DataMediaType dataMediaType, String encoding) { + BasicDataSource dbcpDs = new BasicDataSource(); + + dbcpDs.setRemoveAbandoned(true); + dbcpDs.setLogAbandoned(true); + dbcpDs.setTestOnBorrow(true); + dbcpDs.setTestWhileIdle(true); + + // 动态的参数 + dbcpDs.setDriverClassName(driverClassName); + dbcpDs.setUrl(url); + dbcpDs.setUsername(userName); + dbcpDs.setPassword(password); + + if (dataMediaType.isOracle()) { + dbcpDs.addConnectionProperty("restrictGetTables", "true"); + dbcpDs.setValidationQuery("select 1 from dual"); + } else if (dataMediaType.isMysql()) { + // open the batch mode for mysql since 5.1.8 + dbcpDs.addConnectionProperty("useServerPrepStmts", "true"); + dbcpDs.addConnectionProperty("rewriteBatchedStatements", "true"); + if (StringUtils.isNotEmpty(encoding)) { + dbcpDs.addConnectionProperty("characterEncoding", encoding); + } + dbcpDs.setValidationQuery("select 1"); + } + + return dbcpDs; + } +} diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedInt.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedInt.java index 303dc0df..140ed2a5 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedInt.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedInt.java @@ -1,68 +1,82 @@ -package com.alibaba.otter.node.etl.common.datasource; - -import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; - -/** - * 类TestMysqlUnsignedInt.java的实现描述 - * - * @author xiaoqing.zhouxq 2011-12-23 上午10:03:37 - */ -public class TestMysqlUnsignedInt { - - public static void insertNumeric() throws ClassNotFoundException, SQLException { - Class.forName("com.mysql.jdbc.Driver"); - Properties from = new Properties(); - from.put("user", "root"); - from.put("password", "root"); - from.put("characterEncoding", "utf8"); - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); - PreparedStatement pst = conn.prepareStatement("insert into unsignednumeric(id,id1,id2,id3) values (?,?,?,?)"); - pst.setLong(1, Integer.MAX_VALUE * 2L); - pst.setLong(2, Integer.MAX_VALUE); - pst.setBigDecimal(3, new BigDecimal("18446744073709551614")); - pst.setBigDecimal(4, new BigDecimal("9223372036854775807")); - pst.executeUpdate(); - - pst.close(); - conn.close(); - } - - public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { - insertNumeric(); - - Thread.sleep(1000L); - - Class.forName("com.mysql.jdbc.Driver"); - Properties from = new Properties(); - from.put("user", "root"); - from.put("password", "root"); - from.put("characterEncoding", "utf8"); - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); - PreparedStatement pst = conn.prepareStatement("select id,id1,id2,id3 from unsignednumeric"); - ResultSet rs = pst.executeQuery(); - while (rs.next()) { - // try { - // System.out.println(rs.getInt(1)); - // } catch (Exception e) { - // System.out.println(rs.getLong(1)); - // } - System.out.println(rs.getLong(1)); - System.out.println(rs.getLong(2)); - System.out.println(rs.getBigDecimal(3)); - // System.out.println(rs.getString(3)); - System.out.println(rs.getBigDecimal(4)); - System.out.println("-----------------------------"); - } - - rs.close(); - pst.close(); - conn.close(); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.datasource; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +/** + * 类TestMysqlUnsignedInt.java的实现描述 + * + * @author xiaoqing.zhouxq 2011-12-23 上午10:03:37 + */ +public class TestMysqlUnsignedInt { + + public static void insertNumeric() throws ClassNotFoundException, SQLException { + Class.forName("com.mysql.jdbc.Driver"); + Properties from = new Properties(); + from.put("user", "root"); + from.put("password", "root"); + from.put("characterEncoding", "utf8"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); + PreparedStatement pst = conn.prepareStatement("insert into unsignednumeric(id,id1,id2,id3) values (?,?,?,?)"); + pst.setLong(1, Integer.MAX_VALUE * 2L); + pst.setLong(2, Integer.MAX_VALUE); + pst.setBigDecimal(3, new BigDecimal("18446744073709551614")); + pst.setBigDecimal(4, new BigDecimal("9223372036854775807")); + pst.executeUpdate(); + + pst.close(); + conn.close(); + } + + public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { + insertNumeric(); + + Thread.sleep(1000L); + + Class.forName("com.mysql.jdbc.Driver"); + Properties from = new Properties(); + from.put("user", "root"); + from.put("password", "root"); + from.put("characterEncoding", "utf8"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); + PreparedStatement pst = conn.prepareStatement("select id,id1,id2,id3 from unsignednumeric"); + ResultSet rs = pst.executeQuery(); + while (rs.next()) { + // try { + // System.out.println(rs.getInt(1)); + // } catch (Exception e) { + // System.out.println(rs.getLong(1)); + // } + System.out.println(rs.getLong(1)); + System.out.println(rs.getLong(2)); + System.out.println(rs.getBigDecimal(3)); + // System.out.println(rs.getString(3)); + System.out.println(rs.getBigDecimal(4)); + System.out.println("-----------------------------"); + } + + rs.close(); + pst.close(); + conn.close(); + } + +} diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedNumber.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedNumber.java index 8d027a7d..911db34d 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedNumber.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/datasource/TestMysqlUnsignedNumber.java @@ -1,66 +1,80 @@ -package com.alibaba.otter.node.etl.common.datasource; - -import java.math.BigDecimal; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; - -/** - * 类TestMysqlUnsignedInt.java的实现描述 - * - * @author xiaoqing.zhouxq 2011-12-23 上午10:03:37 - */ -public class TestMysqlUnsignedNumber { - - public static void insertNumeric() throws ClassNotFoundException, SQLException { - Class.forName("com.mysql.jdbc.Driver"); - Properties from = new Properties(); - from.put("user", "root"); - from.put("password", "root"); - from.put("characterEncoding", "utf8"); - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); - PreparedStatement pst = conn.prepareStatement("insert into unsignednumeric(id,id1,id2,id3) values (?,?,?,?)"); - pst.setLong(1, Integer.MAX_VALUE * 2L); - pst.setLong(2, Integer.MIN_VALUE); - pst.setBigDecimal(3, new BigDecimal("18446744073709551614")); - pst.setBigDecimal(4, new BigDecimal(Long.MIN_VALUE + "")); - pst.executeUpdate(); - - pst.close(); - conn.close(); - } - - public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { - // insertNumeric(); - // - // Thread.sleep(1000L); - - Class.forName("com.mysql.jdbc.Driver"); - Properties from = new Properties(); - from.put("user", "root"); - from.put("password", "root"); - from.put("characterEncoding", "utf8"); - Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); - PreparedStatement pst = conn.prepareStatement("select id,id1,id3 from unsignednumeric"); - ResultSet rs = pst.executeQuery(); - while (rs.next()) { - // try { - // System.out.println(rs.getInt(1)); - // } catch (Exception e) { - // System.out.println(rs.getLong(1)); - // } - System.out.println(rs.getLong(1)); - System.out.println(rs.getLong(2)); - System.out.println(rs.getBigDecimal(3)); - System.out.println("-----------------------------"); - } - - rs.close(); - pst.close(); - conn.close(); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.datasource; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +/** + * 类TestMysqlUnsignedInt.java的实现描述 + * + * @author xiaoqing.zhouxq 2011-12-23 上午10:03:37 + */ +public class TestMysqlUnsignedNumber { + + public static void insertNumeric() throws ClassNotFoundException, SQLException { + Class.forName("com.mysql.jdbc.Driver"); + Properties from = new Properties(); + from.put("user", "root"); + from.put("password", "root"); + from.put("characterEncoding", "utf8"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); + PreparedStatement pst = conn.prepareStatement("insert into unsignednumeric(id,id1,id2,id3) values (?,?,?,?)"); + pst.setLong(1, Integer.MAX_VALUE * 2L); + pst.setLong(2, Integer.MIN_VALUE); + pst.setBigDecimal(3, new BigDecimal("18446744073709551614")); + pst.setBigDecimal(4, new BigDecimal(Long.MIN_VALUE + "")); + pst.executeUpdate(); + + pst.close(); + conn.close(); + } + + public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { + // insertNumeric(); + // + // Thread.sleep(1000L); + + Class.forName("com.mysql.jdbc.Driver"); + Properties from = new Properties(); + from.put("user", "root"); + from.put("password", "root"); + from.put("characterEncoding", "utf8"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/erosa", from); + PreparedStatement pst = conn.prepareStatement("select id,id1,id3 from unsignednumeric"); + ResultSet rs = pst.executeQuery(); + while (rs.next()) { + // try { + // System.out.println(rs.getInt(1)); + // } catch (Exception e) { + // System.out.println(rs.getLong(1)); + // } + System.out.println(rs.getLong(1)); + System.out.println(rs.getLong(2)); + System.out.println(rs.getBigDecimal(3)); + System.out.println("-----------------------------"); + } + + rs.close(); + pst.close(); + conn.close(); + } + +} diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectIntegration.java index 7f509f41..89db879d 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db; import java.sql.PreparedStatement; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTableTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTableTest.java index c670ff54..e4715593 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTableTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTableTest.java @@ -1,54 +1,68 @@ -package com.alibaba.otter.node.etl.common.db; - -import org.apache.ddlutils.model.Column; -import org.apache.ddlutils.model.Table; -import org.jtester.annotations.SpringBeanByName; -import org.testng.annotations.Test; - -import com.alibaba.otter.node.etl.BaseDbTest; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; -import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; -import com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia; - -/** - * 测试下table表的获取操作 - * - * @author jianghang 2012-4-20 下午04:56:43 - * @version 4.0.2 - */ -public class DbDialectTableTest extends BaseDbTest { - - @SpringBeanByName - private DbDialectFactory dbDialectFactory; - - @Test - public void testMysqlTable() { - DbDataMedia mysqlMedia = getMysqlMedia(); - DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, mysqlMedia.getSource()); - Table table = dbDialect.findTable(mysqlMedia.getNamespace(), mysqlMedia.getName()); - want.object(table).notNull(); - - System.out.println("tableName = " + table.getName()); - Column[] columns = table.getColumns(); - for (Column column : columns) { - System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() - + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); - } - - } - - @Test - public void testOracleTable() { - DbDataMedia oracleMedia = getOracleMedia(); - DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, oracleMedia.getSource()); - Table table = dbDialect.findTable(oracleMedia.getNamespace(), oracleMedia.getName()); - want.object(table).notNull(); - - System.out.println("tableName = " + table.getName()); - Column[] columns = table.getColumns(); - for (Column column : columns) { - System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() - + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.etl.common.db; + +import org.apache.ddlutils.model.Column; +import org.apache.ddlutils.model.Table; +import org.jtester.annotations.SpringBeanByName; +import org.testng.annotations.Test; + +import com.alibaba.otter.node.etl.BaseDbTest; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialect; +import com.alibaba.otter.node.etl.common.db.dialect.DbDialectFactory; +import com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia; + +/** + * 测试下table表的获取操作 + * + * @author jianghang 2012-4-20 下午04:56:43 + * @version 4.0.2 + */ +public class DbDialectTableTest extends BaseDbTest { + + @SpringBeanByName + private DbDialectFactory dbDialectFactory; + + @Test + public void testMysqlTable() { + DbDataMedia mysqlMedia = getMysqlMedia(); + DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, mysqlMedia.getSource()); + Table table = dbDialect.findTable(mysqlMedia.getNamespace(), mysqlMedia.getName()); + want.object(table).notNull(); + + System.out.println("tableName = " + table.getName()); + Column[] columns = table.getColumns(); + for (Column column : columns) { + System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() + + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); + } + + } + + @Test + public void testOracleTable() { + DbDataMedia oracleMedia = getOracleMedia(); + DbDialect dbDialect = dbDialectFactory.getDbDialect(1L, oracleMedia.getSource()); + Table table = dbDialect.findTable(oracleMedia.getNamespace(), oracleMedia.getName()); + want.object(table).notNull(); + + System.out.println("tableName = " + table.getName()); + Column[] columns = table.getColumns(); + for (Column column : columns) { + System.out.println("columnName = " + column.getName() + ",columnType = " + column.getTypeCode() + + ",isPrimary = " + column.isPrimaryKey() + ",nullable = " + column.isRequired()); + } + } +} diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTest.java index c8776bdd..f669b666 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbDialectTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db; import java.sql.PreparedStatement; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbPerfIntergration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbPerfIntergration.java index cb7b3698..68f82507 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbPerfIntergration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/DbPerfIntergration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db; import java.sql.PreparedStatement; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/SqlTemplateTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/SqlTemplateTest.java index a3be12af..2e52f6c3 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/SqlTemplateTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/db/SqlTemplateTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.db; import org.testng.annotations.Test; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/AESUtilsTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/AESUtilsTest.java index 90b2329c..169704dd 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/AESUtilsTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/AESUtilsTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import org.apache.commons.lang.math.RandomUtils; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanIntegration.java index afc7b577..e98cd83e 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanTest.java index bf61102b..e49a37d6 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ArchiveBeanTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/Aria2cDownLoadIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/Aria2cDownLoadIntegration.java index 5ac21d9d..84aa3c59 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/Aria2cDownLoadIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/Aria2cDownLoadIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import org.testng.annotations.Test; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ChecksumUtilsTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ChecksumUtilsTest.java index 13a83e43..8113f48a 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ChecksumUtilsTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/ChecksumUtilsTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import org.apache.commons.lang.math.RandomUtils; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/CompressorTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/CompressorTest.java index 0721872c..a9153826 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/CompressorTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/io/CompressorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.io; import java.io.ByteArrayInputStream; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedIntegration.java index f6a2e2e9..78da67ce 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jetty/JettyEmbedIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jetty; import org.eclipse.jetty.server.Connector; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/JmxLoaderIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/JmxLoaderIntegration.java index c23948ec..b2551359 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/JmxLoaderIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/JmxLoaderIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jmx; import java.rmi.RemoteException; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationTest.java index 06415226..b74aaa8c 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/jmx/StageAggregationTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.jmx; import java.util.concurrent.locks.LockSupport; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/HttpPipeIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/HttpPipeIntegration.java index f3488542..5934496a 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/HttpPipeIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/HttpPipeIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/MemoryPipeTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/MemoryPipeTest.java index ffbc7fe6..642a77b4 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/MemoryPipeTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/MemoryPipeTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; import org.testng.annotations.Test; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/RpcPipeTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/RpcPipeTest.java index 3a24de4a..2427aafa 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/RpcPipeTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/common/pipe/RpcPipeTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.common.pipe; import mockit.Mock; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectServiceIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectServiceIntegration.java index d168fbff..41d7945a 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectServiceIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/conflict/FileBatchConflictDetectServiceIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.conflict; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/DatabaseExtractorTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/DatabaseExtractorTest.java index 83b70a9e..61cdfee0 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/DatabaseExtractorTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/DatabaseExtractorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract; import java.sql.Types; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/EventProcessorFactoryIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/EventProcessorFactoryIntegration.java index 8580abf3..d7ae858e 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/EventProcessorFactoryIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/EventProcessorFactoryIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract; public class EventProcessorFactoryIntegration { diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/FreedomExtractorTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/FreedomExtractorTest.java index 7f26908e..1d7f4a80 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/FreedomExtractorTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/extract/FreedomExtractorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.extract; import java.util.ArrayList; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/ArbitrateInitIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/ArbitrateInitIntegration.java index 6c209dcd..4d21b372 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/ArbitrateInitIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/ArbitrateInitIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.launcher; public class ArbitrateInitIntegration { diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/OtterLoaderFactoryIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/OtterLoaderFactoryIntegration.java index f3c729d9..dc5f8f42 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/OtterLoaderFactoryIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/launcher/OtterLoaderFactoryIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.launcher; import java.util.concurrent.CountDownLatch; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadActionTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadActionTest.java index 9ab0f25c..d2162a9a 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadActionTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadActionTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.sql.Types; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadMergerTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadMergerTest.java index 21f2d265..70febb0b 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadMergerTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/DbLoadMergerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.util.ArrayList; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/FileLoadActionTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/FileLoadActionTest.java index f8842eed..b93eedc2 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/FileLoadActionTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/FileLoadActionTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/LocalFileLoaderActionTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/LocalFileLoaderActionTest.java index 0f6bb012..179c674f 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/LocalFileLoaderActionTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/LocalFileLoaderActionTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.io.File; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBarrierTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBarrierTest.java index b6b024a9..fe1d80cc 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBarrierTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBarrierTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.util.concurrent.Callable; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBucketTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBucketTest.java index 2392bbc4..d04a25a0 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBucketTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightBucketTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.util.List; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightControllerTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightControllerTest.java index 3649a2e9..baaebfe4 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightControllerTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/load/WeightControllerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.load; import java.util.ArrayList; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/select/CanalClientIntegration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/select/CanalClientIntegration.java index 417ab920..d4e8efff 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/select/CanalClientIntegration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/select/CanalClientIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select; import org.jtester.annotations.SpringBeanByName; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/select/OtterDownStreamHandlerIntergration.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/select/OtterDownStreamHandlerIntergration.java index bff72a47..55bc7426 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/select/OtterDownStreamHandlerIntergration.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/select/OtterDownStreamHandlerIntergration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.select; import java.util.Arrays; diff --git a/node/etl/src/test/java/com/alibaba/otter/node/etl/transform/OtterTransformerTest.java b/node/etl/src/test/java/com/alibaba/otter/node/etl/transform/OtterTransformerTest.java index 86a4c5ef..c6b97baa 100644 --- a/node/etl/src/test/java/com/alibaba/otter/node/etl/transform/OtterTransformerTest.java +++ b/node/etl/src/test/java/com/alibaba/otter/node/etl/transform/OtterTransformerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.etl.transform; import java.io.File; diff --git a/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/AbstractFileResolver.java b/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/AbstractFileResolver.java index fd8b97d9..745ca6a2 100644 --- a/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/AbstractFileResolver.java +++ b/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/AbstractFileResolver.java @@ -1,18 +1,32 @@ -package com.alibaba.otter.node.extend.fileresolver; - -import com.alibaba.otter.shared.etl.extend.fileresolver.FileResolver; - -/** - * @author jianghang 2012-10-23 下午04:11:14 - * @version 4.1.0 - */ -public abstract class AbstractFileResolver implements FileResolver { - - public boolean isDeleteRequired() { - return false; - } - - public boolean isDistributed() { - return false; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.extend.fileresolver; + +import com.alibaba.otter.shared.etl.extend.fileresolver.FileResolver; + +/** + * @author jianghang 2012-10-23 下午04:11:14 + * @version 4.1.0 + */ +public abstract class AbstractFileResolver implements FileResolver { + + public boolean isDeleteRequired() { + return false; + } + + public boolean isDistributed() { + return false; + } +} diff --git a/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/TestFileResolver.java b/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/TestFileResolver.java index b219244a..faaf0d31 100644 --- a/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/TestFileResolver.java +++ b/node/extend/src/main/java/com/alibaba/otter/node/extend/fileresolver/TestFileResolver.java @@ -1,26 +1,40 @@ -package com.alibaba.otter.node.extend.fileresolver; - -import java.util.Map; - -import com.alibaba.otter.shared.etl.extend.fileresolver.FileInfo; - -public class TestFileResolver extends AbstractFileResolver { - - public FileInfo[] getFileInfo(Map rowMap) { - String labelAddress = rowMap.get("REMARKS"); - String arandaAddress = rowMap.get("REMARKS2"); - FileInfo fileInfo = null; - if (labelAddress != null && labelAddress.length() != 0) { - if (arandaAddress != null && arandaAddress.length() != 0) { - fileInfo = new FileInfo(arandaAddress, labelAddress); - } else { - fileInfo = new FileInfo(labelAddress); - } - - return new FileInfo[] { fileInfo }; - } else { - return null; - } - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.node.extend.fileresolver; + +import java.util.Map; + +import com.alibaba.otter.shared.etl.extend.fileresolver.FileInfo; + +public class TestFileResolver extends AbstractFileResolver { + + public FileInfo[] getFileInfo(Map rowMap) { + String labelAddress = rowMap.get("REMARKS"); + String arandaAddress = rowMap.get("REMARKS2"); + FileInfo fileInfo = null; + if (labelAddress != null && labelAddress.length() != 0) { + if (arandaAddress != null && arandaAddress.length() != 0) { + fileInfo = new FileInfo(arandaAddress, labelAddress); + } else { + fileInfo = new FileInfo(labelAddress); + } + + return new FileInfo[] { fileInfo }; + } else { + return null; + } + } + +} diff --git a/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/AbstractEventProcessor.java b/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/AbstractEventProcessor.java index 05784c0f..ef984993 100644 --- a/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/AbstractEventProcessor.java +++ b/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/AbstractEventProcessor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.extend.processor; import org.apache.commons.lang.StringUtils; diff --git a/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/HavanaMemberProcessor.java b/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/HavanaMemberProcessor.java index bcf438ff..19d7a39f 100644 --- a/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/HavanaMemberProcessor.java +++ b/node/extend/src/main/java/com/alibaba/otter/node/extend/processor/HavanaMemberProcessor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.node.extend.processor; import org.apache.commons.lang.StringUtils; diff --git a/pom.xml b/pom.xml index 96eff160..b000c118 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ 8 - zavakid + hatter http://hatter.me jht5945@gmail.com 8 diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateEventService.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateEventService.java index 86ea3bb7..5c0fa74c 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateEventService.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateEventService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate; import com.alibaba.otter.shared.arbitrate.impl.setl.ExtractArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateManageService.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateManageService.java index c7785872..86626e21 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateManageService.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateManageService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate; import com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateViewService.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateViewService.java index ad3eb8b3..a28998fd 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateViewService.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/ArbitrateViewService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/exception/ArbitrateException.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/exception/ArbitrateException.java index 19261bdb..15c285b1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/exception/ArbitrateException.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/exception/ArbitrateException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateConstants.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateConstants.java index 99908f2d..af1a4925 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateConstants.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateConstants.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEvent.java index 14b31741..75d6f927 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEventServiceImpl.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEventServiceImpl.java index ff6f1a05..f91b264a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEventServiceImpl.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateEventServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl; import com.alibaba.otter.shared.arbitrate.ArbitrateEventService; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateManageServiceImpl.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateManageServiceImpl.java index b6857a7f..7927f564 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateManageServiceImpl.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateManageServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl; import com.alibaba.otter.shared.arbitrate.ArbitrateManageService; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateViewServiceImpl.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateViewServiceImpl.java index 59ebac03..d29fe7da 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateViewServiceImpl.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/ArbitrateViewServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl; import java.io.UnsupportedEncodingException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/alarm/AlarmClientService.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/alarm/AlarmClientService.java index 0c7c5865..46ed1135 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/alarm/AlarmClientService.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/alarm/AlarmClientService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.alarm; import java.text.MessageFormat; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/communication/ArbitrateCommmunicationClient.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/communication/ArbitrateCommmunicationClient.java index bf9aa7e6..35045b20 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/communication/ArbitrateCommmunicationClient.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/communication/ArbitrateCommmunicationClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.communication; import java.util.Arrays; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfig.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfig.java index 96352a61..ddfdc0e2 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfig.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfig.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.config; import com.alibaba.otter.shared.common.model.config.channel.Channel; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigRegistry.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigRegistry.java index 8b8df268..1859a9df 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigRegistry.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigRegistry.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.config; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigUtils.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigUtils.java index 2a94692e..e155a35a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigUtils.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/config/ArbitrateConfigUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.config; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/interceptor/LogInterceptor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/interceptor/LogInterceptor.java index acd3a86c..61e6b22e 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/interceptor/LogInterceptor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/interceptor/LogInterceptor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.interceptor; import java.text.MessageFormat; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/ChannelArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/ChannelArbitrateEvent.java index 8714df14..ec51e237 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/ChannelArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/ChannelArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeArbitrateEvent.java index 6b0bcda4..8ed9ea78 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeSessionExpired.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeSessionExpired.java index a288f716..611ad5e1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeSessionExpired.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/NodeSessionExpired.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/PipelineArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/PipelineArbitrateEvent.java index 5d4de94f..e97f73f3 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/PipelineArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/PipelineArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage; import org.I0Itec.zkclient.exception.ZkException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/SystemArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/SystemArbitrateEvent.java index e4832c17..b0081f21 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/SystemArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/SystemArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage; import org.I0Itec.zkclient.exception.ZkBadVersionException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/helper/ManagePathUtils.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/helper/ManagePathUtils.java index 4dc0ab69..bb2923fc 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/helper/ManagePathUtils.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/manage/helper/ManagePathUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.manage.helper; import java.text.MessageFormat; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateFactory.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateFactory.java index 29cfd7a7..36c702f8 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateFactory.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import java.lang.reflect.Constructor; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateLifeCycle.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateLifeCycle.java index 0f9880fa..3af3cd3e 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateLifeCycle.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ArbitrateLifeCycle.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ExtractArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ExtractArbitrateEvent.java index 23529b96..d63d4e29 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ExtractArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ExtractArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import com.alibaba.otter.shared.arbitrate.impl.ArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/LoadArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/LoadArbitrateEvent.java index b52522e7..e80c6aa3 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/LoadArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/LoadArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import com.alibaba.otter.shared.arbitrate.impl.ArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/MainStemArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/MainStemArbitrateEvent.java index 18b92b37..241b2b65 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/MainStemArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/MainStemArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/SelectArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/SelectArbitrateEvent.java index f762e81f..1173dae7 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/SelectArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/SelectArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import com.alibaba.otter.shared.arbitrate.impl.ArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TerminArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TerminArbitrateEvent.java index 8dc87132..d007044c 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TerminArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TerminArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import com.alibaba.otter.shared.arbitrate.model.TerminEventData; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ToolArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ToolArbitrateEvent.java index 6d1ebcf6..ac078178 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ToolArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/ToolArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TransformArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TransformArbitrateEvent.java index 73d87778..f686ed16 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TransformArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/TransformArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl; import com.alibaba.otter.shared.arbitrate.impl.ArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/AbstractDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/AbstractDelegateArbitrateEvent.java index 4ec47824..768cfa91 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/AbstractDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/AbstractDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/ExtractDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/ExtractDelegateArbitrateEvent.java index 33e813e3..197a18bd 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/ExtractDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/ExtractDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/LoadDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/LoadDelegateArbitrateEvent.java index 19e68eba..5f92311c 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/LoadDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/LoadDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/SelectDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/SelectDelegateArbitrateEvent.java index 5d461c98..b07e1d61 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/SelectDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/SelectDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TerminDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TerminDelegateArbitrateEvent.java index 00d6c866..60b6c614 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TerminDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TerminDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TransformDelegateArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TransformDelegateArbitrateEvent.java index cea7e32c..b71be266 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TransformDelegateArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/delegate/TransformDelegateArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.delegate; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageController.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageController.java index 62324a13..1ca1b164 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageController.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.fastrpc; import com.alibaba.otter.shared.arbitrate.impl.setl.ArbitrateLifeCycle; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageEventDispatcher.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageEventDispatcher.java index d52dabb6..79f71204 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageEventDispatcher.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/fastrpc/FastRpcStageEventDispatcher.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.fastrpc; import org.springframework.util.Assert; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/RemedyIndexComparator.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/RemedyIndexComparator.java index bd38e159..b09220d4 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/RemedyIndexComparator.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/RemedyIndexComparator.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import java.util.Comparator; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/ReplyProcessQueue.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/ReplyProcessQueue.java index cbb5fcf0..b827b535 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/ReplyProcessQueue.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/ReplyProcessQueue.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import java.util.LinkedHashMap; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageComparator.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageComparator.java index 887c244b..3094b327 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageComparator.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageComparator.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import java.util.Comparator; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StagePathUtils.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StagePathUtils.java index f0ac995b..52f4d2ef 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StagePathUtils.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StagePathUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import java.text.MessageFormat; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageProgress.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageProgress.java index c3411cc1..0a3835f1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageProgress.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/StageProgress.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/TerminProcessQueue.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/TerminProcessQueue.java index 5c7bee5c..ebc9f6db 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/TerminProcessQueue.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/helper/TerminProcessQueue.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.helper; import java.util.PriorityQueue; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/AbstractLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/AbstractLoadBalance.java index 6e49bbeb..cd2b2ec5 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/AbstractLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/AbstractLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRandomLoadBanlance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRandomLoadBanlance.java index 2e609fe2..3a914ce6 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRandomLoadBanlance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRandomLoadBanlance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRoundRobinLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRoundRobinLoadBalance.java index 5e161f34..e946024f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRoundRobinLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractRoundRobinLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractStickLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractStickLoadBalance.java index 0368b204..3e7f69e0 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractStickLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/ExtractStickLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalance.java index 71ef9096..eb2d7c2f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import com.alibaba.otter.shared.common.model.config.node.Node; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalanceFactory.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalanceFactory.java index d18bd043..57f33673 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalanceFactory.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/LoadBalanceFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import com.alibaba.otter.shared.arbitrate.impl.config.ArbitrateConfigUtils; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RandomLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RandomLoadBalance.java index d71474d4..800f4fdd 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RandomLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RandomLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RoundRobinLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RoundRobinLoadBalance.java index f0acdcb2..7a74ede1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RoundRobinLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/RoundRobinLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/StickLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/StickLoadBalance.java index 22b7d6dc..b7b349d8 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/StickLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/StickLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRandomLoadBanlance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRandomLoadBanlance.java index 4ba72701..4f9faa12 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRandomLoadBanlance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRandomLoadBanlance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRoundRobinLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRoundRobinLoadBalance.java index f00e7c52..8e01bf80 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRoundRobinLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformRoundRobinLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformStickLoadBalance.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformStickLoadBalance.java index 5f06a2ae..bd027648 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformStickLoadBalance.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/lb/TransformStickLoadBalance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.lb; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/ExtractMemoryArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/ExtractMemoryArbitrateEvent.java index 0356e45c..1075233c 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/ExtractMemoryArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/ExtractMemoryArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/LoadMemoryArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/LoadMemoryArbitrateEvent.java index ee4c0eb0..a9584517 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/LoadMemoryArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/LoadMemoryArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/MemoryStageController.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/MemoryStageController.java index 0c2e492c..034f100c 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/MemoryStageController.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/MemoryStageController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/SelectMemoryArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/SelectMemoryArbitrateEvent.java index d22dc7b1..1a53828b 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/SelectMemoryArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/SelectMemoryArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TerminMemoryArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TerminMemoryArbitrateEvent.java index 747e6aeb..6467668b 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TerminMemoryArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TerminMemoryArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TransformMemoryArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TransformMemoryArbitrateEvent.java index 098d8e16..bde788da 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TransformMemoryArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/memory/TransformMemoryArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.memory; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MainstemMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MainstemMonitor.java index cd83adf0..f4017fa7 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MainstemMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MainstemMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/Monitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/Monitor.java index 99fbcc0c..68753d9a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/Monitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/Monitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MonitorScheduler.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MonitorScheduler.java index c551bd6f..683671f4 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MonitorScheduler.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/MonitorScheduler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/NodeMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/NodeMonitor.java index 6c49de4c..88b7709f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/NodeMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/NodeMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/PermitMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/PermitMonitor.java index 16e23a4c..26764297 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/PermitMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/PermitMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/TerminMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/TerminMonitor.java index c141c74f..016e17e2 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/TerminMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/TerminMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/MainstemListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/MainstemListener.java index dbc5dc1d..8f85edcb 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/MainstemListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/MainstemListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor.listener; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/NodeListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/NodeListener.java index ca31fcec..711aca0a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/NodeListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/NodeListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor.listener; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/PermitListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/PermitListener.java index eac2eecc..fe6a6b23 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/PermitListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/monitor/listener/PermitListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.monitor.listener; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/ExtractRpcArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/ExtractRpcArbitrateEvent.java index 2e6d688f..97d4b8f6 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/ExtractRpcArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/ExtractRpcArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/LoadRpcArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/LoadRpcArbitrateEvent.java index d0c1c19e..cf8bc096 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/LoadRpcArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/LoadRpcArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageController.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageController.java index c3364c70..7b7ece9a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageController.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageController.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageEventDispatcher.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageEventDispatcher.java index 2901fab8..7a15ca61 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageEventDispatcher.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/RpcStageEventDispatcher.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import org.springframework.util.Assert; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/SelectRpcArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/SelectRpcArbitrateEvent.java index 5a4a8665..88d480ee 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/SelectRpcArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/SelectRpcArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminExecutor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminExecutor.java index 9eea6e53..220da8c1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminExecutor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminExecutor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import java.util.concurrent.ExecutorService; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminRpcArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminRpcArbitrateEvent.java index a040dd8c..b094adc0 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminRpcArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TerminRpcArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import com.alibaba.otter.shared.arbitrate.impl.setl.TerminArbitrateEvent; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TransformRpcArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TransformRpcArbitrateEvent.java index 3afe0b6a..493e8249 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TransformRpcArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/TransformRpcArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/AbstractProcessListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/AbstractProcessListener.java index e1802392..b949bcf4 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/AbstractProcessListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/AbstractProcessListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessListener.java index 8bda8291..b6ccc4cf 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessMonitor.java index 23fc03f1..efc45f33 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/ProcessMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/SelectProcessListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/SelectProcessListener.java index d93716a4..23bcb337 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/SelectProcessListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/rpc/monitor/SelectProcessListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.rpc.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java index 6dad59d9..da190516 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/ExtractZooKeeperArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper; import org.I0Itec.zkclient.exception.ZkException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/LoadZooKeeperArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/LoadZooKeeperArbitrateEvent.java index 1d85abd7..1ae7c9eb 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/LoadZooKeeperArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/LoadZooKeeperArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/SelectZooKeeperArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/SelectZooKeeperArbitrateEvent.java index a24cbb3f..61f4db92 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/SelectZooKeeperArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/SelectZooKeeperArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TerminZooKeeperArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TerminZooKeeperArbitrateEvent.java index 48f2351e..b5dac8b1 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TerminZooKeeperArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TerminZooKeeperArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper; import org.I0Itec.zkclient.exception.ZkException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TransformZooKeeperArbitrateEvent.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TransformZooKeeperArbitrateEvent.java index 78d09dc7..161716d7 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TransformZooKeeperArbitrateEvent.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/TransformZooKeeperArbitrateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper; import org.I0Itec.zkclient.exception.ZkException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/AbstractStageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/AbstractStageListener.java index fe32df6d..fe22db81 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/AbstractStageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/AbstractStageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/ExtractStageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/ExtractStageListener.java index 5b3eb662..bef85842 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/ExtractStageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/ExtractStageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/LoadStageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/LoadStageListener.java index 77845aa2..fd07cc46 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/LoadStageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/LoadStageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/SelectStageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/SelectStageListener.java index 204aa7cc..18ccc3be 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/SelectStageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/SelectStageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageListener.java index 0f6af751..6d257e16 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageMonitor.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageMonitor.java index 455ef72d..1661cde0 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageMonitor.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/StageMonitor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/TransformStageListener.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/TransformStageListener.java index 85760f15..d36c63ad 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/TransformStageListener.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/monitor/TransformStageListener.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.monitor; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/ErrorTerminProcess.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/ErrorTerminProcess.java index 92eb358c..c7bbb920 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/ErrorTerminProcess.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/ErrorTerminProcess.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.termin; import java.util.ArrayList; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/NormalTerminProcess.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/NormalTerminProcess.java index df20cb04..ebce673f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/NormalTerminProcess.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/NormalTerminProcess.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.termin; import java.util.Collections; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/TerminProcess.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/TerminProcess.java index 0f223012..63b77b84 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/TerminProcess.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/TerminProcess.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.termin; import com.alibaba.otter.shared.arbitrate.model.TerminEventData; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/WarningTerminProcess.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/WarningTerminProcess.java index 2a4b2c25..3ff6b8f2 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/WarningTerminProcess.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/setl/zookeeper/termin/WarningTerminProcess.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.termin; import org.slf4j.Logger; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/AsyncWatcher.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/AsyncWatcher.java index a7fd3bb3..d90eda2f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/AsyncWatcher.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/AsyncWatcher.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; import java.util.concurrent.ArrayBlockingQueue; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/SessionExpiredNotification.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/SessionExpiredNotification.java index e263cd65..200394b6 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/SessionExpiredNotification.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/SessionExpiredNotification.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperClient.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperClient.java index fb7b2a0f..50cf90dc 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperClient.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; import java.util.Arrays; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperHeartBeatWorker.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperHeartBeatWorker.java index 4450161f..e9358b26 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperHeartBeatWorker.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperHeartBeatWorker.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; import java.util.concurrent.ScheduledThreadPoolExecutor; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperOperation.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperOperation.java index b6502e02..3ccd5934 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperOperation.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperOperation.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; import org.apache.zookeeper.KeeperException; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperx.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperx.java index a0fb6b36..75b38333 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperx.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/ZooKeeperx.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedLock.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedLock.java index 83cb0838..c58f5691 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedLock.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedLock.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper.lock; import java.util.List; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedReentrantLock.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedReentrantLock.java index 29e7eef2..9e258cd5 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedReentrantLock.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/DistributedReentrantLock.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper.lock; import java.text.MessageFormat; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/LockNode.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/LockNode.java index ff24942f..6e9c944a 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/LockNode.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/impl/zookeeper/lock/LockNode.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.impl.zookeeper.lock; import org.springframework.util.Assert; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EtlEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EtlEventData.java index 61d352ad..fa173e7e 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EtlEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EtlEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EventData.java index 9c3698b1..8993c857 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/EventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; import java.io.Serializable; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/MainStemEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/MainStemEventData.java index e40d9ed2..b8557fc7 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/MainStemEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/MainStemEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PipelineEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PipelineEventData.java index 8cb168e1..55aea3ec 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PipelineEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PipelineEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; /** diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PositionEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PositionEventData.java index 99601fb1..f5e36aae 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PositionEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/PositionEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; import java.util.Date; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessEventData.java index 969f03d6..30f31c16 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; import java.util.Map; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessNodeEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessNodeEventData.java index fe6a2e22..ddf0c944 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessNodeEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/ProcessNodeEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; import com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.ArbitrateMode; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/RemedyIndexEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/RemedyIndexEventData.java index b00c7070..7b6bbb4e 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/RemedyIndexEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/RemedyIndexEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; import org.apache.commons.lang.StringUtils; diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/SyncStatusEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/SyncStatusEventData.java index 7a5dc4de..dd4d45bc 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/SyncStatusEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/SyncStatusEventData.java @@ -1,113 +1,127 @@ -package com.alibaba.otter.shared.arbitrate.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * eromanga中取出的一批数据需要划分成多个process进行同步,保存process的数目和每个process同步的数据量,以及这一批数据同步是否成功. - * - * @author jianghang 2011-10-18 上午10:16:12 - * @version 4.0.0 - */ -public class SyncStatusEventData extends PipelineEventData { - - private static final long serialVersionUID = -1755817244279698216L; - private List status = new ArrayList(); - /** - * 初始值为并行度,在ProcessEndTask收到一个process的ack以后,就减1,如果=0时,就可以开启SelectConsumerTask去取下一批数据了. - */ - private long parallelism; - - public void decParallelism() { - --parallelism; - } - - public void addParallelism() { - ++parallelism; - } - - public List getStatus() { - return status; - } - - public void setStatus(List status) { - this.status = status; - } - - public void addStatus(SyncStatus status) { - this.status.add(status); - } - - public long getParallelism() { - return parallelism; - } - - public void setParallelism(long parallelism) { - this.parallelism = parallelism; - } - - /** - * @author xiaoqing.zhouxq - */ - public static class SyncStatus implements Serializable { - - private static final long serialVersionUID = 794565950364625433L; - - public static final long DEFAULT_PROCESSID = -1; - - /** - * 划分成的多个process同步是否成功,如果成功,给eromanga发送ack,如果失败,从eromanga中取同一批数据, 并且过滤掉已经同步成功的process的数据. - */ - private boolean status; - - /** - * 每个process需要同步的数据量. - */ - private int processDataCount; - - private long processId = DEFAULT_PROCESSID; - - public SyncStatus(){ - - } - - public SyncStatus(boolean status, int processDataCount){ - this.status = status; - this.processDataCount = processDataCount; - } - - public boolean isStatus() { - return status; - } - - public void setStatus(boolean status) { - this.status = status; - } - - public int getProcessDataCount() { - return processDataCount; - } - - public void setProcessDataCount(int processDataCount) { - this.processDataCount = processDataCount; - } - - public long getProcessId() { - return processId; - } - - public void setProcessId(long processId) { - this.processId = processId; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.arbitrate.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * eromanga中取出的一批数据需要划分成多个process进行同步,保存process的数目和每个process同步的数据量,以及这一批数据同步是否成功. + * + * @author jianghang 2011-10-18 上午10:16:12 + * @version 4.0.0 + */ +public class SyncStatusEventData extends PipelineEventData { + + private static final long serialVersionUID = -1755817244279698216L; + private List status = new ArrayList(); + /** + * 初始值为并行度,在ProcessEndTask收到一个process的ack以后,就减1,如果=0时,就可以开启SelectConsumerTask去取下一批数据了. + */ + private long parallelism; + + public void decParallelism() { + --parallelism; + } + + public void addParallelism() { + ++parallelism; + } + + public List getStatus() { + return status; + } + + public void setStatus(List status) { + this.status = status; + } + + public void addStatus(SyncStatus status) { + this.status.add(status); + } + + public long getParallelism() { + return parallelism; + } + + public void setParallelism(long parallelism) { + this.parallelism = parallelism; + } + + /** + * @author xiaoqing.zhouxq + */ + public static class SyncStatus implements Serializable { + + private static final long serialVersionUID = 794565950364625433L; + + public static final long DEFAULT_PROCESSID = -1; + + /** + * 划分成的多个process同步是否成功,如果成功,给eromanga发送ack,如果失败,从eromanga中取同一批数据, 并且过滤掉已经同步成功的process的数据. + */ + private boolean status; + + /** + * 每个process需要同步的数据量. + */ + private int processDataCount; + + private long processId = DEFAULT_PROCESSID; + + public SyncStatus(){ + + } + + public SyncStatus(boolean status, int processDataCount){ + this.status = status; + this.processDataCount = processDataCount; + } + + public boolean isStatus() { + return status; + } + + public void setStatus(boolean status) { + this.status = status; + } + + public int getProcessDataCount() { + return processDataCount; + } + + public void setProcessDataCount(int processDataCount) { + this.processDataCount = processDataCount; + } + + public long getProcessId() { + return processId; + } + + public void setProcessId(long processId) { + this.processId = processId; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + } +} diff --git a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/TerminEventData.java b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/TerminEventData.java index fb003e77..39a7a45f 100644 --- a/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/TerminEventData.java +++ b/shared/arbitrate/src/main/java/com/alibaba/otter/shared/arbitrate/model/TerminEventData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.model; /** diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseEventTest.java index f5401b12..3a8cb935 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseOtterTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseOtterTest.java index 396cfbe0..62fd2f3c 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseOtterTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/ArbitrateAllTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/ArbitrateAllTest.java index 9b4d2cf4..da3e6578 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/ArbitrateAllTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/ArbitrateAllTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateForwardIntegration.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateForwardIntegration.java index ce7aeb83..d11e4ed6 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateForwardIntegration.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateForwardIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.multi; import java.io.IOException; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateOppositeIntegration.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateOppositeIntegration.java index cc326666..3910f4bf 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateOppositeIntegration.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ArbitrateOppositeIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.multi; import java.io.IOException; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ChannelArbitrateEventIntegration.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ChannelArbitrateEventIntegration.java index b1ed3d22..eb15db6a 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ChannelArbitrateEventIntegration.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/multi/ChannelArbitrateEventIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.multi; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ExtractServiceDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ExtractServiceDemo.java index 7c69e29b..b4f3c48d 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ExtractServiceDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ExtractServiceDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/LoadServiceDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/LoadServiceDemo.java index d2abbc23..aa6d6ad5 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/LoadServiceDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/LoadServiceDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/MainStemServiceDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/MainStemServiceDemo.java index 0e90887d..d253220c 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/MainStemServiceDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/MainStemServiceDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/PipelineLifeCycle.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/PipelineLifeCycle.java index 19484a39..5297347f 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/PipelineLifeCycle.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/PipelineLifeCycle.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; public interface PipelineLifeCycle { diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ProcessViewDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ProcessViewDemo.java index 1b016967..424faba1 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ProcessViewDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/ProcessViewDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.io.File; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/SelectServiceDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/SelectServiceDemo.java index adb766a7..23360ec1 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/SelectServiceDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/SelectServiceDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TerminProcessDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TerminProcessDemo.java index ec1bcdcc..104b34fb 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TerminProcessDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TerminProcessDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.io.File; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TransformServiceDemo.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TransformServiceDemo.java index f79572cd..498154ba 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TransformServiceDemo.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/demo/servcie/TransformServiceDemo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.demo.servcie; import java.util.Map; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ArbitrateViewServiceTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ArbitrateViewServiceTest.java index ff0504c9..c66e6ba1 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ArbitrateViewServiceTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ArbitrateViewServiceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.manage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ChannelArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ChannelArbitrateEventTest.java index 3c063404..3ebd67a6 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ChannelArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/ChannelArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.manage; import mockit.Mock; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/NodeArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/NodeArbitrateEventTest.java index c22ffb01..722d5a0e 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/NodeArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/NodeArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.manage; import org.testng.annotations.BeforeMethod; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/PipelineArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/PipelineArbitrateEventTest.java index 03dfd295..1f0ff662 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/PipelineArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/manage/PipelineArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.manage; import mockit.Mock; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/BaseStageTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/BaseStageTest.java index 37eefc8e..4497a00f 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/BaseStageTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/BaseStageTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/BaseArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/BaseArbitrateEventTest.java index 91605e17..8f26776b 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/BaseArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/BaseArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event; import org.testng.annotations.AfterMethod; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/MainStemArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/MainStemArbitrateEventTest.java index 1a756a30..5c264ce4 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/MainStemArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/MainStemArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/ToolArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/ToolArbitrateEventTest.java index 27fb24a4..92b437ca 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/ToolArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/ToolArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event; import java.util.Date; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/MemoryArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/MemoryArbitrateEventTest.java index 9ab5c9ff..da34b3a5 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/MemoryArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/MemoryArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.memory; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/TerminMemoryArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/TerminMemoryArbitrateEventTest.java index 10fefb19..ec5262e9 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/TerminMemoryArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/memory/TerminMemoryArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.memory; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/rpc/RpcArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/rpc/RpcArbitrateEventTest.java index 47d12a39..e8e5bf85 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/rpc/RpcArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/rpc/RpcArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.rpc; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/ExtractArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/ExtractArbitrateEventTest.java index 7f909a92..cb8537a3 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/ExtractArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/ExtractArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.zookeeper; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/LoadArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/LoadArbitrateEventTest.java index 559aafe5..0d419265 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/LoadArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/LoadArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.zookeeper; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/SelectArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/SelectArbitrateEventTest.java index 08c66580..fdba6004 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/SelectArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/SelectArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.zookeeper; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TerminArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TerminArbitrateEventTest.java index 0a06f02a..a00717ac 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TerminArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TerminArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.zookeeper; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TransformArbitrateEventTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TransformArbitrateEventTest.java index f8ac4161..83cc06eb 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TransformArbitrateEventTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/event/zookeeper/TransformArbitrateEventTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.event.zookeeper; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/BaseLoadBalanceTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/BaseLoadBalanceTest.java index f86d8a11..c013233e 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/BaseLoadBalanceTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/BaseLoadBalanceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.lb; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RandomLoadBalanceTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RandomLoadBalanceTest.java index 3dfbfb88..1e0c9fe0 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RandomLoadBalanceTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RandomLoadBalanceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.lb; import mockit.Mock; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RoundRobinBalanceTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RoundRobinBalanceTest.java index a251273c..7913b7c0 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RoundRobinBalanceTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/lb/RoundRobinBalanceTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.lb; import mockit.Mock; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/MainStemMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/MainStemMonitorTest.java index 55d995d7..dbafe23b 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/MainStemMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/MainStemMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/PermitMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/PermitMonitorTest.java index 91152da5..25681eb7 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/PermitMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/PermitMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor; import java.util.concurrent.CountDownLatch; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/ProcessMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/ProcessMonitorTest.java index 3fc7fb6b..e80e4934 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/ProcessMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/ProcessMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/TerminMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/TerminMonitorTest.java index 06baade3..77f1ab33 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/TerminMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/TerminMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor; import mockit.Mock; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/node/NodeMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/node/NodeMonitorTest.java index 6b31a838..795d2bb2 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/node/NodeMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/node/NodeMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.node; import java.util.Arrays; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/ExtractStageListenerTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/ExtractStageListenerTest.java index 63e913a0..689db50a 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/ExtractStageListenerTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/ExtractStageListenerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.stage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/LoadStageListenerTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/LoadStageListenerTest.java index 6a9df5d2..ff987f72 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/LoadStageListenerTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/LoadStageListenerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.stage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/SelectStageListenerTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/SelectStageListenerTest.java index 8d3244c7..9a906635 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/SelectStageListenerTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/SelectStageListenerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.stage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/StageMonitorTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/StageMonitorTest.java index e63f0b7a..3118524d 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/StageMonitorTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/StageMonitorTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.stage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/TransformStageListenerTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/TransformStageListenerTest.java index 840bfafd..bf34a85b 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/TransformStageListenerTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/setl/monitor/stage/TransformStageListenerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.setl.monitor.stage; import java.util.ArrayList; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedLockTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedLockTest.java index ece2a848..81c950cf 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedLockTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedLockTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.zookeeper; import java.util.concurrent.CountDownLatch; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedReentrantLockTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedReentrantLockTest.java index 6fc85263..dbe2b2eb 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedReentrantLockTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/DistributedReentrantLockTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.zookeeper; import java.util.concurrent.CountDownLatch; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperCleanerIntegration.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperCleanerIntegration.java index 2cec0a1d..df118788 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperCleanerIntegration.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperCleanerIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.zookeeper; import java.util.List; diff --git a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperClientTest.java b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperClientTest.java index 987eae46..867dc856 100644 --- a/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperClientTest.java +++ b/shared/arbitrate/src/test/java/com/alibaba/otter/shared/arbitrate/zookeeper/ZooKeeperClientTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.arbitrate.zookeeper; import java.io.IOException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperCluster.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperCluster.java index d01af71e..c4950cbd 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperCluster.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperCluster.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperConnectionStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperConnectionStat.java index 24bb2b97..0bb2a236 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperConnectionStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperConnectionStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; import java.util.HashSet; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperEphemeralStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperEphemeralStat.java index 7620a91e..4b1d2171 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperEphemeralStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperEphemeralStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; import java.util.List; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperQuorumType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperQuorumType.java index c94f94a1..6302ee94 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperQuorumType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperQuorumType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperServerStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperServerStat.java index 4c2205a0..4bbe57f9 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperServerStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperServerStat.java @@ -1,105 +1,119 @@ -package com.alibaba.otter.shared.common.model.autokeeper; - -import java.util.HashSet; -import java.util.Set; - -/** - * zk服务对应统计信息 - * - *

- * 命令:echo stat | nc 10.20.144.51 2181
- * Zookeeper version: 3.3.6-1366786, built on 07/29/2012 06:22 GMT
- * Clients:
- *  /10.20.144.51:34480[0](queued=0,recved=1,sent=0)
- *  /10.20.144.22:60731[1](queued=0,recved=1853744,sent=2466780)
- * 
- * Latency min/avg/max: 0/0/99
- * Received: 1857451
- * Sent: 2470863
- * Outstanding: 0
- * Zxid: 0x1b03de020b
- * Mode: follower
- * Node count: 1758
- * 
- * - * @author jianghang 2012-9-21 下午02:13:40 - * @version 4.1.0 - */ -public class AutoKeeperServerStat extends AutoKeeperStateStat { - - private static final long serialVersionUID = 617926406886982808L; - private String address; - private String version; - private AutoKeeperQuorumType quorumType; // 运行类型,leader/follower/observer - private long nodeCount; // 总的节点数 - private Set connectionStats = new HashSet(); // 客户端链接状态 - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public Set getConnectionStats() { - return connectionStats; - } - - public void setConnectionStats(Set connectionStats) { - this.connectionStats = connectionStats; - } - - public AutoKeeperQuorumType getQuorumType() { - return quorumType; - } - - public void setQuorumType(AutoKeeperQuorumType quorumType) { - this.quorumType = quorumType; - } - - public long getNodeCount() { - return nodeCount; - } - - public void setNodeCount(long nodeCount) { - this.nodeCount = nodeCount; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((address == null) ? 0 : address.hashCode()); - return result; - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof AutoKeeperServerStat)) { - return false; - } - AutoKeeperServerStat other = (AutoKeeperServerStat) obj; - if (address == null) { - if (other.address != null) { - return false; - } - } else if (!address.equals(other.address)) { - return false; - } - return true; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.model.autokeeper; + +import java.util.HashSet; +import java.util.Set; + +/** + * zk服务对应统计信息 + * + *
+ * 命令:echo stat | nc 10.20.144.51 2181
+ * Zookeeper version: 3.3.6-1366786, built on 07/29/2012 06:22 GMT
+ * Clients:
+ *  /10.20.144.51:34480[0](queued=0,recved=1,sent=0)
+ *  /10.20.144.22:60731[1](queued=0,recved=1853744,sent=2466780)
+ * 
+ * Latency min/avg/max: 0/0/99
+ * Received: 1857451
+ * Sent: 2470863
+ * Outstanding: 0
+ * Zxid: 0x1b03de020b
+ * Mode: follower
+ * Node count: 1758
+ * 
+ * + * @author jianghang 2012-9-21 下午02:13:40 + * @version 4.1.0 + */ +public class AutoKeeperServerStat extends AutoKeeperStateStat { + + private static final long serialVersionUID = 617926406886982808L; + private String address; + private String version; + private AutoKeeperQuorumType quorumType; // 运行类型,leader/follower/observer + private long nodeCount; // 总的节点数 + private Set connectionStats = new HashSet(); // 客户端链接状态 + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Set getConnectionStats() { + return connectionStats; + } + + public void setConnectionStats(Set connectionStats) { + this.connectionStats = connectionStats; + } + + public AutoKeeperQuorumType getQuorumType() { + return quorumType; + } + + public void setQuorumType(AutoKeeperQuorumType quorumType) { + this.quorumType = quorumType; + } + + public long getNodeCount() { + return nodeCount; + } + + public void setNodeCount(long nodeCount) { + this.nodeCount = nodeCount; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((address == null) ? 0 : address.hashCode()); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof AutoKeeperServerStat)) { + return false; + } + AutoKeeperServerStat other = (AutoKeeperServerStat) obj; + if (address == null) { + if (other.address != null) { + return false; + } + } else if (!address.equals(other.address)) { + return false; + } + return true; + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStat.java index cad35379..833b691f 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStateStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStateStat.java index 8db04a51..982cb2d7 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStateStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperStateStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperWatchStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperWatchStat.java index f8543792..0fc0716b 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperWatchStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/autokeeper/AutoKeeperWatchStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.autokeeper; import java.util.List; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigException.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigException.java index 31aa497a..7a7d1350 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigException.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigHelper.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigHelper.java index c3bcc6a9..6b860f63 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigHelper.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ConfigHelper.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config; import java.util.ArrayList; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ModeValueFilter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ModeValueFilter.java index 68722bcd..4975b549 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ModeValueFilter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/ModeValueFilter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/Transient.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/Transient.java index 6bc5ee1d..20b10226 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/Transient.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/Transient.java @@ -1,13 +1,27 @@ -package com.alibaba.otter.shared.common.model.config; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target({ ElementType.FIELD, ElementType.PARAMETER }) -@Retention(RetentionPolicy.RUNTIME) -public @interface Transient { - - boolean value() default true; -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.model.config; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.FIELD, ElementType.PARAMETER }) +@Retention(RetentionPolicy.RUNTIME) +public @interface Transient { + + boolean value() default true; +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRule.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRule.java index 1b0a4a38..7e3cdd90 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRule.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRule.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.alarm; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRuleStatus.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRuleStatus.java index 437394a4..e49b15ae 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRuleStatus.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/AlarmRuleStatus.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.alarm; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/MonitorName.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/MonitorName.java index f16e2542..ebcd6ea5 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/MonitorName.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/alarm/MonitorName.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.alarm; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/Channel.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/Channel.java index ff6a6f14..6ba1a01b 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/Channel.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/Channel.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.channel; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelParameter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelParameter.java index e091aded..6b08c0e7 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelParameter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.channel; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelStatus.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelStatus.java index 24a3e04e..9cba0fa2 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelStatus.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/channel/ChannelStatus.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.channel; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/Column.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/Column.java index b21c0775..454b598f 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/Column.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/Column.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnGroup.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnGroup.java index 05678e0d..ef32fb4d 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnGroup.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnGroup.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPair.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPair.java index 382fac38..c9deb213 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPair.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPairMode.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPairMode.java index f077bf73..70b1d974 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPairMode.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ColumnPairMode.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMatrix.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMatrix.java index f69b67e0..0f940ffa 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMatrix.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMatrix.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMedia.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMedia.java index 74cf8ff4..d62be39c 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMedia.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaPair.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaPair.java index aebc37ec..f0641518 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaPair.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaPair.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaSource.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaSource.java index 479f9891..ba021aea 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaSource.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaType.java index d3ca1ac0..522d02da 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/DataMediaType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionData.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionData.java index e498a6a2..1fb4ec18 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionData.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionDataType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionDataType.java index b64b994f..4e8d92ce 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionDataType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/ExtensionDataType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbDataMedia.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbDataMedia.java index 25abb3f4..da8c8554 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbDataMedia.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbDataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data.db; import com.alibaba.otter.shared.common.model.config.data.DataMedia; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbMediaSource.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbMediaSource.java index 7a2b5170..44acf514 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbMediaSource.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/db/DbMediaSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data.db; import java.util.Properties; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqDataMedia.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqDataMedia.java index 16678807..22f702fc 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqDataMedia.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqDataMedia.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data.mq; import com.alibaba.otter.shared.common.model.config.data.DataMedia; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqMediaSource.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqMediaSource.java index 2de23ab5..f48eb381 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqMediaSource.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/data/mq/MqMediaSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.data.mq; import com.alibaba.otter.shared.common.model.config.data.DataMediaSource; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/AreaType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/AreaType.java index 18590917..c0c973de 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/AreaType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/AreaType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.enums; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/StageType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/StageType.java index 7058fcfc..e04aa450 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/StageType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/enums/StageType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.enums; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/Node.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/Node.java index dd358862..4dd19b6d 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/Node.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/Node.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.node; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeParameter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeParameter.java index 98025383..d8f96a9c 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeParameter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.node; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeStatus.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeStatus.java index 5827c593..85fbb5a8 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeStatus.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/node/NodeStatus.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.node; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/Parameter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/Parameter.java index c651d909..8c64878f 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/Parameter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/Parameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.parameter; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/SystemParameter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/SystemParameter.java index 305324ba..4b698c50 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/SystemParameter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/parameter/SystemParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.parameter; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/Pipeline.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/Pipeline.java index 966e9f1e..b33fe956 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/Pipeline.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/Pipeline.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.pipeline; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/PipelineParameter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/PipelineParameter.java index ed172091..5dbc1987 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/PipelineParameter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/pipeline/PipelineParameter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.pipeline; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/record/LogRecord.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/record/LogRecord.java index c1076912..02527409 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/record/LogRecord.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/config/record/LogRecord.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.config.record; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayCount.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayCount.java index 35b0365e..d6b8de42 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayCount.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayCount.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.delay; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayStat.java index ca2271ef..669b1cf1 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/delay/DelayStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.delay; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/ProcessStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/ProcessStat.java index c51fa321..fc8f7dd0 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/ProcessStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/ProcessStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.stage; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/StageStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/StageStat.java index 917b67fb..e2965ad8 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/StageStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/stage/StageStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.stage; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/table/TableStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/table/TableStat.java index 57382d99..d144edc3 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/table/TableStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/table/TableStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.table; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputStat.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputStat.java index 739b49ba..3c3a9119 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputStat.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputStat.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.throughput; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputType.java index c76e6d3b..71cde3f2 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/statistics/throughput/ThroughputType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.statistics.throughput; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/AuthorizeType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/AuthorizeType.java index d870835f..f9d454bf 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/AuthorizeType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/AuthorizeType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.user; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/User.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/User.java index 793d2fc2..8f49f5ab 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/User.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/model/user/User.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.model.user; import java.io.Serializable; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/AddressUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/AddressUtils.java index 7895f3f8..a4c44377 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/AddressUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/AddressUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.IOException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/Assert.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/Assert.java index 77572ef5..dd76188f 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/Assert.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/Assert.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; public final class Assert { diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/ByteUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/ByteUtils.java index c53bcd75..ecc1a239 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/ByteUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/ByteUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.UnsupportedEncodingException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/JsonUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/JsonUtils.java index 79c64a56..e5e46d3b 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/JsonUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/JsonUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.lang.reflect.Field; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/NioUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/NioUtils.java index 235d023e..aecce5ef 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/NioUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/NioUtils.java @@ -1,509 +1,523 @@ -package com.alibaba.otter.shared.common.utils; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.channels.Channels; -import java.nio.channels.FileChannel; -import java.nio.channels.ReadableByteChannel; -import java.nio.channels.WritableByteChannel; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 基于nio技术,提供一些快速的stream处理 - * - * @author jianghang 2011-10-9 下午06:28:44 - * @version 4.0.0 - */ -public class NioUtils { - - private static final Logger logger = LoggerFactory.getLogger(NioUtils.class); - private static final int DEFAULT_BUFFER_SIZE = 8 * 1024; - private static final int timeWait = 1000; - - /** - * 基于流的数据copy - */ - public static long copy(InputStream input, OutputStream output, long offset) throws IOException { - long count = 0; - long n = 0; - if (input instanceof FileInputStream) { - FileChannel inChannel = ((FileInputStream) input).getChannel(); - WritableByteChannel outChannel = Channels.newChannel(output); - count = inChannel.transferTo(offset, inChannel.size() - offset, outChannel); - } else if (output instanceof FileOutputStream) { - FileChannel outChannel = ((FileOutputStream) output).getChannel(); - ReadableByteChannel inChannel = Channels.newChannel(input); - do { - n = outChannel.transferFrom(inChannel, offset + count, DEFAULT_BUFFER_SIZE); - count += n; - } while (n > 0); - } else { - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - - input.skip(offset); - while (-1 != (n = input.read(buffer))) { - output.write(buffer, 0, (int) n); - count += n; - } - // ReadableByteChannel inChannel = Channels.newChannel(input); - // WritableByteChannel outChannel = Channels.newChannel(output); - // - // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); - // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); - // while (-1 != (n = inChannel.read(buffer))) { - // outChannel.write(buffer); - // count += n; - // } - } - return count; - } - - /** - * 基于流的数据copy - */ - public static long copy(InputStream input, OutputStream output, long offset, long count) throws IOException { - long rcount = 0; - long n = 0; - if (input instanceof FileInputStream) { - FileChannel inChannel = ((FileInputStream) input).getChannel(); - WritableByteChannel outChannel = Channels.newChannel(output); - rcount = inChannel.transferTo(offset, count, outChannel); - } else if (output instanceof FileOutputStream) { - FileChannel outChannel = ((FileOutputStream) output).getChannel(); - ReadableByteChannel inChannel = Channels.newChannel(input); - do { - if (count < DEFAULT_BUFFER_SIZE) { - n = outChannel.transferFrom(inChannel, offset + rcount, count); - } else { - n = outChannel.transferFrom(inChannel, offset + rcount, DEFAULT_BUFFER_SIZE); - } - count -= n; - rcount += n; - } while (n > 0); - } else { - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - - input.skip(offset); - while (count > 0) { - if (count < DEFAULT_BUFFER_SIZE) { - n = input.read(buffer, 0, (int) count); - } else { - n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); - } - - output.write(buffer, 0, (int) n); - count -= n; - rcount += n; - } - // ReadableByteChannel inChannel = Channels.newChannel(input); - // WritableByteChannel outChannel = Channels.newChannel(output); - // - // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); - // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); - // while (-1 != (n = inChannel.read(buffer))) { - // outChannel.write(buffer); - // count += n; - // } - } - return rcount; - } - - /** - * 基于流的数据copy - */ - public static long copy(InputStream input, OutputStream output) throws IOException { - long count = 0; - long n = 0; - if (input instanceof FileInputStream) { - FileChannel inChannel = ((FileInputStream) input).getChannel(); - WritableByteChannel outChannel = Channels.newChannel(output); - count = inChannel.transferTo(0, inChannel.size(), outChannel); - } else if (output instanceof FileOutputStream) { - FileChannel outChannel = ((FileOutputStream) output).getChannel(); - ReadableByteChannel inChannel = Channels.newChannel(input); - do { - n = outChannel.transferFrom(inChannel, count, DEFAULT_BUFFER_SIZE); - count += n; - } while (n > 0); - } else { - byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; - - while (-1 != (n = input.read(buffer))) { - output.write(buffer, 0, (int) n); - count += n; - } - // ReadableByteChannel inChannel = Channels.newChannel(input); - // WritableByteChannel outChannel = Channels.newChannel(output); - // - // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); - // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); - // while (-1 != (n = inChannel.read(buffer))) { - // outChannel.write(buffer); - // count += n; - // } - } - return count; - } - - /** - * 将byte[]数据写入到流中 - */ - public static void write(byte[] data, OutputStream output) throws IOException { - ByteArrayInputStream input = null; - try { - input = new ByteArrayInputStream(data); - copy(input, output); - output.flush(); - } finally { - IOUtils.closeQuietly(output); - } - } - - /** - * 将byte数组写入文件 - */ - public static void write(final byte[] srcArray, File targetFile) throws IOException { - write(srcArray, targetFile, true); - } - - /** - * 将byte数组写入文件 - */ - public static void write(final byte[] srcArray, File targetFile, final boolean overwrite) throws IOException { - if (srcArray == null) { - throw new IOException("Source must not be null"); - } - - if (targetFile == null) { - throw new IOException("Target must not be null"); - } - - if (true == targetFile.exists()) { - if (true == targetFile.isDirectory()) { - throw new IOException("Target '" + targetFile.getAbsolutePath() + "' is directory!"); - } else if (true == targetFile.isFile()) { - if (!overwrite) { - throw new IOException("Target file '" + targetFile.getAbsolutePath() + "' already exists!"); - } - } else { - throw new IOException("Invalid target object '" + targetFile.getAbsolutePath() + "'!"); - } - } else { - // create parent dir - create(targetFile.getParentFile(), false, 3); - } - - // 使用无拷贝的inputStream - ByteArrayInputStream input = null; - FileOutputStream output = null; - try { - input = new ByteArrayInputStream(srcArray); - output = new FileOutputStream(targetFile); - copy(input, output); - output.flush(); - } finally { - IOUtils.closeQuietly(input); - IOUtils.closeQuietly(output); - } - } - - /** - * 读取文件到数组 - */ - public static byte[] read(File sourceFile) throws IOException { - if (sourceFile == null) { - throw new IOException("Source must not be null"); - } - - if (false == sourceFile.exists()) { - throw new IOException("Source '" + sourceFile + "' does not exist"); - } - - if (true == sourceFile.isDirectory()) { - throw new IOException("Source '" + sourceFile + "' exists but is a directory"); - } - - FileInputStream input = null; - ByteArrayOutputStream output = null; - - try { - input = new FileInputStream(sourceFile); - output = new ByteArrayOutputStream(); - copy(input, output); - output.flush(); - return output.toByteArray(); - } finally { - IOUtils.closeQuietly(input); - IOUtils.closeQuietly(output); - } - } - - /** - * 从流中读数据到byte[] - */ - public static byte[] read(InputStream input) throws IOException { - ByteArrayOutputStream output = null; - try { - output = new ByteArrayOutputStream(); - copy(input, output); - output.flush(); - return output.toByteArray(); - } finally { - IOUtils.closeQuietly(output); - } - } - - /** - * Copy file overwrite - */ - public static void copy(final File src, File dest) throws IOException { - copy(src, dest, 1); - } - - /** - * 尝试多次复制文件,排除网络故障 - * - * @param src - * @param dest - * @param retryTimes - * @throws IOException - */ - public static boolean copy(final File src, File dest, final int retryTimes) throws IOException { - int totalRetry = retryTimes; - - if (retryTimes < 1) { - totalRetry = 1; - } - - int retry = 0; - while (retry++ < totalRetry) { - try { - copy(src, dest, true); - return true; - } catch (Exception ex) { - // 本次等待时间 - int wait = (int) Math.pow(retry, retry) * timeWait; - wait = (wait < timeWait) ? timeWait : wait; - - if (retry == totalRetry) { - if (ex instanceof IOException) { - throw (IOException) ex; - } else { - throw new IOException((ex == null) ? "unknow error" : ex.getMessage(), ex); - } - } else { - try { - Thread.sleep(wait); - } catch (InterruptedException e) { - // ignore - } - } - } - } - - return false; - } - - /** - * Copy source file to destination. If destination is a path then source file name is appended. If destination file - * exists then: overwrite=true - destination file is replaced; overwite=false - exception is thrown - */ - public static void copy(final File sourceFile, File targetFile, final boolean overwrite) throws IOException { - if (sourceFile == null) { - throw new IOException("Source must not be null"); - } - - if (targetFile == null) { - throw new IOException("Target must not be null"); - } - - // checks - if ((false == sourceFile.isFile()) || (false == sourceFile.exists())) { - throw new IOException("Source file '" + sourceFile.getAbsolutePath() + "' not found!"); - } - - if (true == targetFile.exists()) { - if (true == targetFile.isDirectory()) { - - // Directory? -> use source file name - targetFile = new File(targetFile, sourceFile.getName()); - } else if (true == targetFile.isFile()) { - if (false == overwrite) { - throw new IOException("Target file '" + targetFile.getAbsolutePath() + "' already exists!"); - } - } else { - throw new IOException("Invalid target object '" + targetFile.getAbsolutePath() + "'!"); - } - } else { - // create parent dir - FileUtils.forceMkdir(targetFile.getParentFile()); - } - - FileInputStream input = null; - FileOutputStream output = null; - - try { - input = new FileInputStream(sourceFile); - output = new FileOutputStream(targetFile); - copy(input, output); - output.flush(); - } finally { - IOUtils.closeQuietly(input); - IOUtils.closeQuietly(output); - } - } - - /** - * 正常创建 - */ - public static boolean create(File dest) { - return create(dest, true, 1); - } - - /** - * 尝试多次创建 - */ - public static boolean create(File dest, final boolean isFile, final int retryTimes) { - if (dest == null) { - return false; - } - - int totalRetry = retryTimes; - - if (retryTimes < 0) { - totalRetry = 1; - } - - int retry = 0; - while (retry++ < totalRetry) { - try { - if (true == isFile) { - if ((true == dest.exists()) || (true == dest.createNewFile())) { - return true; - } - } else { - FileUtils.forceMkdir(dest); - return true; - } - } catch (Exception ex) { - // 本次等待时间 - int wait = (int) Math.pow(retry, retry) * timeWait; - wait = (wait < timeWait) ? timeWait : wait; - - // 尝试等待 - if (retry == totalRetry) { - return false; - } else { - - // 记录日志 - logger.warn(String.format("[%s] create() - retry %s failed : wait [%s] ms , caused by %s", - dest.getAbsolutePath(), retry, wait, ex.getMessage())); - try { - Thread.sleep(wait); - } catch (InterruptedException e) { - return false; - } - } - } - } - - return false; - } - - /** - * 正常删除,实在不行就jvm退出时删除 - * - * @param dest - * @param retryTimes - */ - public static boolean delete(File dest) { - return delete(dest, 1); - } - - /** - * 尝试多次删除,实在不行就jvm退出时删除 - * - * @param dest - * @param retryTimes - */ - public static boolean delete(File dest, final int retryTimes) { - if (dest == null) { - return false; - } - - if (false == dest.exists()) { - return true; - } - - int totalRetry = retryTimes; - if (retryTimes < 1) { - totalRetry = 1; - } - - int retry = 0; - while (retry++ < totalRetry) { - try { - FileUtils.forceDelete(dest); - return true; - } catch (FileNotFoundException ex) { - return true; - } catch (Exception ex) { - // 本次等待时间 - int wait = (int) Math.pow(retry, retry) * timeWait; - wait = (wait < timeWait) ? timeWait : wait; - if (retry == totalRetry) { - try { - FileUtils.forceDeleteOnExit(dest); - return false; - } catch (Exception e) { - // ignore - } - } else { - // 记录日志 - logger.warn(String.format("[%s] delete() - retry %s failed : wait [%s] ms , caused by %s", - dest.getAbsolutePath(), retry, wait, ex.getMessage())); - try { - Thread.sleep(wait); - } catch (InterruptedException e) { - // ignore - } - } - } - } - - return false; - } - - /** - * Move file without retry - */ - public static void move(final File src, File dest) throws IOException { - move(src, dest, 1); - } - - /** - * Moves the source file to the destination. If the destination cannot be created or is a read-only file, the method - * returns false. Otherwise, the contents of the source are copied to the destination, the source is - * deleted, and true is returned. - * - * @param src The source file to move. - * @param dest The destination where to move the file. - * @param retryTimes Move and delete retry times - */ - public static void move(final File src, File dest, final int retryTimes) throws IOException { - copy(src, dest, retryTimes); - delete(src, retryTimes); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.channels.Channels; +import java.nio.channels.FileChannel; +import java.nio.channels.ReadableByteChannel; +import java.nio.channels.WritableByteChannel; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 基于nio技术,提供一些快速的stream处理 + * + * @author jianghang 2011-10-9 下午06:28:44 + * @version 4.0.0 + */ +public class NioUtils { + + private static final Logger logger = LoggerFactory.getLogger(NioUtils.class); + private static final int DEFAULT_BUFFER_SIZE = 8 * 1024; + private static final int timeWait = 1000; + + /** + * 基于流的数据copy + */ + public static long copy(InputStream input, OutputStream output, long offset) throws IOException { + long count = 0; + long n = 0; + if (input instanceof FileInputStream) { + FileChannel inChannel = ((FileInputStream) input).getChannel(); + WritableByteChannel outChannel = Channels.newChannel(output); + count = inChannel.transferTo(offset, inChannel.size() - offset, outChannel); + } else if (output instanceof FileOutputStream) { + FileChannel outChannel = ((FileOutputStream) output).getChannel(); + ReadableByteChannel inChannel = Channels.newChannel(input); + do { + n = outChannel.transferFrom(inChannel, offset + count, DEFAULT_BUFFER_SIZE); + count += n; + } while (n > 0); + } else { + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + + input.skip(offset); + while (-1 != (n = input.read(buffer))) { + output.write(buffer, 0, (int) n); + count += n; + } + // ReadableByteChannel inChannel = Channels.newChannel(input); + // WritableByteChannel outChannel = Channels.newChannel(output); + // + // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); + // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); + // while (-1 != (n = inChannel.read(buffer))) { + // outChannel.write(buffer); + // count += n; + // } + } + return count; + } + + /** + * 基于流的数据copy + */ + public static long copy(InputStream input, OutputStream output, long offset, long count) throws IOException { + long rcount = 0; + long n = 0; + if (input instanceof FileInputStream) { + FileChannel inChannel = ((FileInputStream) input).getChannel(); + WritableByteChannel outChannel = Channels.newChannel(output); + rcount = inChannel.transferTo(offset, count, outChannel); + } else if (output instanceof FileOutputStream) { + FileChannel outChannel = ((FileOutputStream) output).getChannel(); + ReadableByteChannel inChannel = Channels.newChannel(input); + do { + if (count < DEFAULT_BUFFER_SIZE) { + n = outChannel.transferFrom(inChannel, offset + rcount, count); + } else { + n = outChannel.transferFrom(inChannel, offset + rcount, DEFAULT_BUFFER_SIZE); + } + count -= n; + rcount += n; + } while (n > 0); + } else { + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + + input.skip(offset); + while (count > 0) { + if (count < DEFAULT_BUFFER_SIZE) { + n = input.read(buffer, 0, (int) count); + } else { + n = input.read(buffer, 0, DEFAULT_BUFFER_SIZE); + } + + output.write(buffer, 0, (int) n); + count -= n; + rcount += n; + } + // ReadableByteChannel inChannel = Channels.newChannel(input); + // WritableByteChannel outChannel = Channels.newChannel(output); + // + // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); + // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); + // while (-1 != (n = inChannel.read(buffer))) { + // outChannel.write(buffer); + // count += n; + // } + } + return rcount; + } + + /** + * 基于流的数据copy + */ + public static long copy(InputStream input, OutputStream output) throws IOException { + long count = 0; + long n = 0; + if (input instanceof FileInputStream) { + FileChannel inChannel = ((FileInputStream) input).getChannel(); + WritableByteChannel outChannel = Channels.newChannel(output); + count = inChannel.transferTo(0, inChannel.size(), outChannel); + } else if (output instanceof FileOutputStream) { + FileChannel outChannel = ((FileOutputStream) output).getChannel(); + ReadableByteChannel inChannel = Channels.newChannel(input); + do { + n = outChannel.transferFrom(inChannel, count, DEFAULT_BUFFER_SIZE); + count += n; + } while (n > 0); + } else { + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + + while (-1 != (n = input.read(buffer))) { + output.write(buffer, 0, (int) n); + count += n; + } + // ReadableByteChannel inChannel = Channels.newChannel(input); + // WritableByteChannel outChannel = Channels.newChannel(output); + // + // //ByteBuffer buffer = new ByteBuffer(DEFAULT_BUFFER_SIZE); + // ByteBuffer buffer = ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE); + // while (-1 != (n = inChannel.read(buffer))) { + // outChannel.write(buffer); + // count += n; + // } + } + return count; + } + + /** + * 将byte[]数据写入到流中 + */ + public static void write(byte[] data, OutputStream output) throws IOException { + ByteArrayInputStream input = null; + try { + input = new ByteArrayInputStream(data); + copy(input, output); + output.flush(); + } finally { + IOUtils.closeQuietly(output); + } + } + + /** + * 将byte数组写入文件 + */ + public static void write(final byte[] srcArray, File targetFile) throws IOException { + write(srcArray, targetFile, true); + } + + /** + * 将byte数组写入文件 + */ + public static void write(final byte[] srcArray, File targetFile, final boolean overwrite) throws IOException { + if (srcArray == null) { + throw new IOException("Source must not be null"); + } + + if (targetFile == null) { + throw new IOException("Target must not be null"); + } + + if (true == targetFile.exists()) { + if (true == targetFile.isDirectory()) { + throw new IOException("Target '" + targetFile.getAbsolutePath() + "' is directory!"); + } else if (true == targetFile.isFile()) { + if (!overwrite) { + throw new IOException("Target file '" + targetFile.getAbsolutePath() + "' already exists!"); + } + } else { + throw new IOException("Invalid target object '" + targetFile.getAbsolutePath() + "'!"); + } + } else { + // create parent dir + create(targetFile.getParentFile(), false, 3); + } + + // 使用无拷贝的inputStream + ByteArrayInputStream input = null; + FileOutputStream output = null; + try { + input = new ByteArrayInputStream(srcArray); + output = new FileOutputStream(targetFile); + copy(input, output); + output.flush(); + } finally { + IOUtils.closeQuietly(input); + IOUtils.closeQuietly(output); + } + } + + /** + * 读取文件到数组 + */ + public static byte[] read(File sourceFile) throws IOException { + if (sourceFile == null) { + throw new IOException("Source must not be null"); + } + + if (false == sourceFile.exists()) { + throw new IOException("Source '" + sourceFile + "' does not exist"); + } + + if (true == sourceFile.isDirectory()) { + throw new IOException("Source '" + sourceFile + "' exists but is a directory"); + } + + FileInputStream input = null; + ByteArrayOutputStream output = null; + + try { + input = new FileInputStream(sourceFile); + output = new ByteArrayOutputStream(); + copy(input, output); + output.flush(); + return output.toByteArray(); + } finally { + IOUtils.closeQuietly(input); + IOUtils.closeQuietly(output); + } + } + + /** + * 从流中读数据到byte[] + */ + public static byte[] read(InputStream input) throws IOException { + ByteArrayOutputStream output = null; + try { + output = new ByteArrayOutputStream(); + copy(input, output); + output.flush(); + return output.toByteArray(); + } finally { + IOUtils.closeQuietly(output); + } + } + + /** + * Copy file overwrite + */ + public static void copy(final File src, File dest) throws IOException { + copy(src, dest, 1); + } + + /** + * 尝试多次复制文件,排除网络故障 + * + * @param src + * @param dest + * @param retryTimes + * @throws IOException + */ + public static boolean copy(final File src, File dest, final int retryTimes) throws IOException { + int totalRetry = retryTimes; + + if (retryTimes < 1) { + totalRetry = 1; + } + + int retry = 0; + while (retry++ < totalRetry) { + try { + copy(src, dest, true); + return true; + } catch (Exception ex) { + // 本次等待时间 + int wait = (int) Math.pow(retry, retry) * timeWait; + wait = (wait < timeWait) ? timeWait : wait; + + if (retry == totalRetry) { + if (ex instanceof IOException) { + throw (IOException) ex; + } else { + throw new IOException((ex == null) ? "unknow error" : ex.getMessage(), ex); + } + } else { + try { + Thread.sleep(wait); + } catch (InterruptedException e) { + // ignore + } + } + } + } + + return false; + } + + /** + * Copy source file to destination. If destination is a path then source file name is appended. If destination file + * exists then: overwrite=true - destination file is replaced; overwite=false - exception is thrown + */ + public static void copy(final File sourceFile, File targetFile, final boolean overwrite) throws IOException { + if (sourceFile == null) { + throw new IOException("Source must not be null"); + } + + if (targetFile == null) { + throw new IOException("Target must not be null"); + } + + // checks + if ((false == sourceFile.isFile()) || (false == sourceFile.exists())) { + throw new IOException("Source file '" + sourceFile.getAbsolutePath() + "' not found!"); + } + + if (true == targetFile.exists()) { + if (true == targetFile.isDirectory()) { + + // Directory? -> use source file name + targetFile = new File(targetFile, sourceFile.getName()); + } else if (true == targetFile.isFile()) { + if (false == overwrite) { + throw new IOException("Target file '" + targetFile.getAbsolutePath() + "' already exists!"); + } + } else { + throw new IOException("Invalid target object '" + targetFile.getAbsolutePath() + "'!"); + } + } else { + // create parent dir + FileUtils.forceMkdir(targetFile.getParentFile()); + } + + FileInputStream input = null; + FileOutputStream output = null; + + try { + input = new FileInputStream(sourceFile); + output = new FileOutputStream(targetFile); + copy(input, output); + output.flush(); + } finally { + IOUtils.closeQuietly(input); + IOUtils.closeQuietly(output); + } + } + + /** + * 正常创建 + */ + public static boolean create(File dest) { + return create(dest, true, 1); + } + + /** + * 尝试多次创建 + */ + public static boolean create(File dest, final boolean isFile, final int retryTimes) { + if (dest == null) { + return false; + } + + int totalRetry = retryTimes; + + if (retryTimes < 0) { + totalRetry = 1; + } + + int retry = 0; + while (retry++ < totalRetry) { + try { + if (true == isFile) { + if ((true == dest.exists()) || (true == dest.createNewFile())) { + return true; + } + } else { + FileUtils.forceMkdir(dest); + return true; + } + } catch (Exception ex) { + // 本次等待时间 + int wait = (int) Math.pow(retry, retry) * timeWait; + wait = (wait < timeWait) ? timeWait : wait; + + // 尝试等待 + if (retry == totalRetry) { + return false; + } else { + + // 记录日志 + logger.warn(String.format("[%s] create() - retry %s failed : wait [%s] ms , caused by %s", + dest.getAbsolutePath(), retry, wait, ex.getMessage())); + try { + Thread.sleep(wait); + } catch (InterruptedException e) { + return false; + } + } + } + } + + return false; + } + + /** + * 正常删除,实在不行就jvm退出时删除 + * + * @param dest + * @param retryTimes + */ + public static boolean delete(File dest) { + return delete(dest, 1); + } + + /** + * 尝试多次删除,实在不行就jvm退出时删除 + * + * @param dest + * @param retryTimes + */ + public static boolean delete(File dest, final int retryTimes) { + if (dest == null) { + return false; + } + + if (false == dest.exists()) { + return true; + } + + int totalRetry = retryTimes; + if (retryTimes < 1) { + totalRetry = 1; + } + + int retry = 0; + while (retry++ < totalRetry) { + try { + FileUtils.forceDelete(dest); + return true; + } catch (FileNotFoundException ex) { + return true; + } catch (Exception ex) { + // 本次等待时间 + int wait = (int) Math.pow(retry, retry) * timeWait; + wait = (wait < timeWait) ? timeWait : wait; + if (retry == totalRetry) { + try { + FileUtils.forceDeleteOnExit(dest); + return false; + } catch (Exception e) { + // ignore + } + } else { + // 记录日志 + logger.warn(String.format("[%s] delete() - retry %s failed : wait [%s] ms , caused by %s", + dest.getAbsolutePath(), retry, wait, ex.getMessage())); + try { + Thread.sleep(wait); + } catch (InterruptedException e) { + // ignore + } + } + } + } + + return false; + } + + /** + * Move file without retry + */ + public static void move(final File src, File dest) throws IOException { + move(src, dest, 1); + } + + /** + * Moves the source file to the destination. If the destination cannot be created or is a read-only file, the method + * returns false. Otherwise, the contents of the source are copied to the destination, the source is + * deleted, and true is returned. + * + * @param src The source file to move. + * @param dest The destination where to move the file. + * @param retryTimes Move and delete retry times + */ + public static void move(final File src, File dest, final int retryTimes) throws IOException { + copy(src, dest, retryTimes); + delete(src, retryTimes); + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/OtterToStringStyle.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/OtterToStringStyle.java index 3c254c13..7b881b3f 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/OtterToStringStyle.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/OtterToStringStyle.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.text.SimpleDateFormat; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/RegexUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/RegexUtils.java index ff19f84c..f9bf9c95 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/RegexUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/RegexUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.util.Map; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/SecurityUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/SecurityUtils.java index 1a36985f..b2814542 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/SecurityUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/SecurityUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.UnsupportedEncodingException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/TestUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/TestUtils.java index ad62a678..16fcb5ba 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/TestUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/TestUtils.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.lang.management.ManagementFactory; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/ExtensionMemoryMirror.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/ExtensionMemoryMirror.java index b78d2798..85b98710 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/ExtensionMemoryMirror.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/ExtensionMemoryMirror.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.cache; import java.util.Iterator; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/RefreshMemoryMirror.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/RefreshMemoryMirror.java index 9db77d99..67072057 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/RefreshMemoryMirror.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cache/RefreshMemoryMirror.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.cache; import java.util.Calendar; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/Exec.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/Exec.java index de200796..78d0a27d 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/Exec.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/Exec.java @@ -1,184 +1,198 @@ -package com.alibaba.otter.shared.common.utils.cmd; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 外部脚本调用工具 - * - *
- * example:
- *  Result result = Exec.executre("pwd");
- *  String dir = result.getStdout();
- * 
- * - * @author jianghang 2011-9-27 上午10:19:19 - * @version 4.0.0 - */ -public class Exec { - - private static final Logger logger = LoggerFactory.getLogger(Exec.class); - - public static Result execute(String cmd) throws Exception { - return execute(cmd, null, null, null); - } - - public static Result execute(String cmd, String outputLog) throws Exception { - return execute(cmd, outputLog, null, null); - } - - public static Result execute(String cmd, String outputLog, byte[] input) throws Exception { - return execute(cmd, outputLog, input, null); - } - - public static Result execute(String cmd, String outputLog, byte[] input, File workingDir) throws Exception { - // 注意单command命令和多command命令使用方式有所不同,不可完全兼容 - Process process = Runtime.getRuntime().exec(cmd, null, workingDir); - return execute(process, cmd, outputLog, input, workingDir); - } - - public static Result execute(String[] cmds) throws Exception { - return execute(cmds, null, null, null); - } - - public static Result execute(String[] cmds, String outputLog) throws Exception { - return execute(cmds, outputLog, null, null); - } - - public static Result execute(String[] cmds, String outputLog, byte[] input) throws Exception { - return execute(cmds, outputLog, input, null); - } - - public static Result execute(String[] cmds, String outputLog, byte[] input, File workingDir) throws Exception { - // 注意单command命令和多command命令使用方式有所不同,不可完全兼容 - Process process = Runtime.getRuntime().exec(cmds, null, workingDir); - return execute(process, StringUtils.join(cmds, " "), outputLog, input, workingDir); - } - - public static Result execute(Process process, String cmd, String outputLog, byte[] input, File workingDir) - throws Exception { - // 处理输入参数流 - Thread inputThread = new InputPumper((input == null) ? new byte[] {} : input, process.getOutputStream()); - StreamCollector stderr = null; - StreamCollector stdout = null; - FileOutputStream fileOutput = null; - StreamAppender outputLogger = null; - String errString = null; - String outString = null; - - try { - if (outputLog == null) { - stdout = new StreamCollector(process.getInputStream()); - stderr = new StreamCollector(process.getErrorStream()); - stdout.start(); - stderr.start(); - } else { - errString = "stderr output redirected to file " + outputLog; - outString = "stdout output redirected to file " + outputLog; - fileOutput = new FileOutputStream(outputLog); - outputLogger = new StreamAppender(fileOutput); - outputLogger.writeInput(process.getErrorStream(), process.getInputStream()); - } - - inputThread.start(); - - final int exitCode = process.waitFor(); - - inputThread.join(); - - if (outputLogger != null) { - outputLogger.finish(); - } - - if (stdout != null) { - stdout.join(); - outString = stdout.toString(); - } - - if (stderr != null) { - stderr.join(); - errString = stderr.toString(); - } - - return new Result(cmd.toString(), outString, errString, exitCode); - } finally { - IOUtils.closeQuietly(fileOutput); - - if (process != null) { - // evitons http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6462165 - process.getInputStream().close(); - process.getOutputStream().close(); - process.getErrorStream().close(); - process.destroy(); - } - } - } - - // 参数输入处理 - private static class InputPumper extends Thread { - - private final InputStream input; - private final OutputStream output; - - InputPumper(byte[] input, OutputStream output){ - this.output = output; - this.input = new ByteArrayInputStream(input); - this.setName("Input Pumper"); - this.setDaemon(true); - } - - public void run() { - try { - IOUtils.copy(input, output); - } catch (IOException e) { - logger.error("", e); - } finally { - IOUtils.closeQuietly(output); - } - } - } - - public static class Result { - - private final String cmd; - private final int exitCode; - private final String stderr; - private final String stdout; - - private Result(String cmd, String stdout, String stderr, int exitCode){ - this.cmd = cmd; - this.stdout = stdout; - this.stderr = stderr; - this.exitCode = exitCode; - } - - public String getStderr() { - return stderr; - } - - public String getStdout() { - return stdout; - } - - public int getExitCode() { - return exitCode; - } - - public String toString() { - return String.format("Command: %s%sexit code:%s%sstdout:%s%s%sstderr:%s%s%s", cmd, - SystemUtils.LINE_SEPARATOR, exitCode, SystemUtils.LINE_SEPARATOR, - SystemUtils.LINE_SEPARATOR, stdout, SystemUtils.LINE_SEPARATOR, - SystemUtils.LINE_SEPARATOR, stderr, SystemUtils.LINE_SEPARATOR); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.cmd; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 外部脚本调用工具 + * + *
+ * example:
+ *  Result result = Exec.executre("pwd");
+ *  String dir = result.getStdout();
+ * 
+ * + * @author jianghang 2011-9-27 上午10:19:19 + * @version 4.0.0 + */ +public class Exec { + + private static final Logger logger = LoggerFactory.getLogger(Exec.class); + + public static Result execute(String cmd) throws Exception { + return execute(cmd, null, null, null); + } + + public static Result execute(String cmd, String outputLog) throws Exception { + return execute(cmd, outputLog, null, null); + } + + public static Result execute(String cmd, String outputLog, byte[] input) throws Exception { + return execute(cmd, outputLog, input, null); + } + + public static Result execute(String cmd, String outputLog, byte[] input, File workingDir) throws Exception { + // 注意单command命令和多command命令使用方式有所不同,不可完全兼容 + Process process = Runtime.getRuntime().exec(cmd, null, workingDir); + return execute(process, cmd, outputLog, input, workingDir); + } + + public static Result execute(String[] cmds) throws Exception { + return execute(cmds, null, null, null); + } + + public static Result execute(String[] cmds, String outputLog) throws Exception { + return execute(cmds, outputLog, null, null); + } + + public static Result execute(String[] cmds, String outputLog, byte[] input) throws Exception { + return execute(cmds, outputLog, input, null); + } + + public static Result execute(String[] cmds, String outputLog, byte[] input, File workingDir) throws Exception { + // 注意单command命令和多command命令使用方式有所不同,不可完全兼容 + Process process = Runtime.getRuntime().exec(cmds, null, workingDir); + return execute(process, StringUtils.join(cmds, " "), outputLog, input, workingDir); + } + + public static Result execute(Process process, String cmd, String outputLog, byte[] input, File workingDir) + throws Exception { + // 处理输入参数流 + Thread inputThread = new InputPumper((input == null) ? new byte[] {} : input, process.getOutputStream()); + StreamCollector stderr = null; + StreamCollector stdout = null; + FileOutputStream fileOutput = null; + StreamAppender outputLogger = null; + String errString = null; + String outString = null; + + try { + if (outputLog == null) { + stdout = new StreamCollector(process.getInputStream()); + stderr = new StreamCollector(process.getErrorStream()); + stdout.start(); + stderr.start(); + } else { + errString = "stderr output redirected to file " + outputLog; + outString = "stdout output redirected to file " + outputLog; + fileOutput = new FileOutputStream(outputLog); + outputLogger = new StreamAppender(fileOutput); + outputLogger.writeInput(process.getErrorStream(), process.getInputStream()); + } + + inputThread.start(); + + final int exitCode = process.waitFor(); + + inputThread.join(); + + if (outputLogger != null) { + outputLogger.finish(); + } + + if (stdout != null) { + stdout.join(); + outString = stdout.toString(); + } + + if (stderr != null) { + stderr.join(); + errString = stderr.toString(); + } + + return new Result(cmd.toString(), outString, errString, exitCode); + } finally { + IOUtils.closeQuietly(fileOutput); + + if (process != null) { + // evitons http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6462165 + process.getInputStream().close(); + process.getOutputStream().close(); + process.getErrorStream().close(); + process.destroy(); + } + } + } + + // 参数输入处理 + private static class InputPumper extends Thread { + + private final InputStream input; + private final OutputStream output; + + InputPumper(byte[] input, OutputStream output){ + this.output = output; + this.input = new ByteArrayInputStream(input); + this.setName("Input Pumper"); + this.setDaemon(true); + } + + public void run() { + try { + IOUtils.copy(input, output); + } catch (IOException e) { + logger.error("", e); + } finally { + IOUtils.closeQuietly(output); + } + } + } + + public static class Result { + + private final String cmd; + private final int exitCode; + private final String stderr; + private final String stdout; + + private Result(String cmd, String stdout, String stderr, int exitCode){ + this.cmd = cmd; + this.stdout = stdout; + this.stderr = stderr; + this.exitCode = exitCode; + } + + public String getStderr() { + return stderr; + } + + public String getStdout() { + return stdout; + } + + public int getExitCode() { + return exitCode; + } + + public String toString() { + return String.format("Command: %s%sexit code:%s%sstdout:%s%s%sstderr:%s%s%s", cmd, + SystemUtils.LINE_SEPARATOR, exitCode, SystemUtils.LINE_SEPARATOR, + SystemUtils.LINE_SEPARATOR, stdout, SystemUtils.LINE_SEPARATOR, + SystemUtils.LINE_SEPARATOR, stderr, SystemUtils.LINE_SEPARATOR); + } + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamAppender.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamAppender.java index e7d2a7a7..bc2216ee 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamAppender.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamAppender.java @@ -1,71 +1,85 @@ -package com.alibaba.otter.shared.common.utils.cmd; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; - -import org.apache.commons.io.IOUtils; - -public class StreamAppender { - - private Thread errWriter; - private Thread outWriter; - private PrintWriter output; - - public StreamAppender(OutputStream output){ - this.output = new PrintWriter(new BufferedWriter(new OutputStreamWriter(output))); - } - - public void writeInput(final InputStream err, final InputStream out) { - errWriter = new Thread() { - - BufferedReader reader = new BufferedReader(new InputStreamReader(err)); - - public void run() { - try { - String line = null; - while ((line = reader.readLine()) != null) { - output.println(line); - } - } catch (IOException e) { - //ignore - } finally { - output.flush();// 关闭之前flush一下 - IOUtils.closeQuietly(reader); - } - } - }; - outWriter = new Thread() { - - BufferedReader reader = new BufferedReader(new InputStreamReader(out)); - - public void run() { - try { - String line = null; - while ((line = reader.readLine()) != null) { - output.println(line); - } - } catch (IOException e) { - //ignore - } finally { - output.flush();// 关闭之前flush一下 - IOUtils.closeQuietly(reader); - } - } - }; - errWriter.setDaemon(true); - outWriter.setDaemon(true); - errWriter.start(); - outWriter.start(); - } - - public void finish() throws Exception { - outWriter.join(); - errWriter.join(); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.cmd; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + +import org.apache.commons.io.IOUtils; + +public class StreamAppender { + + private Thread errWriter; + private Thread outWriter; + private PrintWriter output; + + public StreamAppender(OutputStream output){ + this.output = new PrintWriter(new BufferedWriter(new OutputStreamWriter(output))); + } + + public void writeInput(final InputStream err, final InputStream out) { + errWriter = new Thread() { + + BufferedReader reader = new BufferedReader(new InputStreamReader(err)); + + public void run() { + try { + String line = null; + while ((line = reader.readLine()) != null) { + output.println(line); + } + } catch (IOException e) { + //ignore + } finally { + output.flush();// 关闭之前flush一下 + IOUtils.closeQuietly(reader); + } + } + }; + outWriter = new Thread() { + + BufferedReader reader = new BufferedReader(new InputStreamReader(out)); + + public void run() { + try { + String line = null; + while ((line = reader.readLine()) != null) { + output.println(line); + } + } catch (IOException e) { + //ignore + } finally { + output.flush();// 关闭之前flush一下 + IOUtils.closeQuietly(reader); + } + } + }; + errWriter.setDaemon(true); + outWriter.setDaemon(true); + errWriter.start(); + outWriter.start(); + } + + public void finish() throws Exception { + outWriter.join(); + errWriter.join(); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCollector.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCollector.java index b7cd9168..a9b57e26 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCollector.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCollector.java @@ -1,19 +1,33 @@ -package com.alibaba.otter.shared.common.utils.cmd; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - -/** - * An object that reads a stream asynchronously and collects it into a data buffer. - */ -public class StreamCollector extends StreamCopier { - - public StreamCollector(InputStream stream){ - // 使用alibaba common io,避免byte多次拷贝 - super(stream, new ByteArrayOutputStream()); - } - - public String toString() { - return new String(((ByteArrayOutputStream) this.out).toByteArray()); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.cmd; + +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + +/** + * An object that reads a stream asynchronously and collects it into a data buffer. + */ +public class StreamCollector extends StreamCopier { + + public StreamCollector(InputStream stream){ + // 使用alibaba common io,避免byte多次拷贝 + super(stream, new ByteArrayOutputStream()); + } + + public String toString() { + return new String(((ByteArrayOutputStream) this.out).toByteArray()); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCopier.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCopier.java index b7471c94..6ed24076 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCopier.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/cmd/StreamCopier.java @@ -1,64 +1,78 @@ -package com.alibaba.otter.shared.common.utils.cmd; - -//~--- non-JDK imports -------------------------------------------------------- - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; - -/** - * A simple thread that copies one stream to another. Useful for copying a process's output/error streams to this - * process's output/error streams. - */ -public class StreamCopier extends Thread { - - protected final String identifier; - protected final OutputStream out; - protected final BufferedReader reader; - - public StreamCopier(InputStream stream, OutputStream out){ - this(stream, out, null); - } - - public StreamCopier(InputStream stream, OutputStream out, String identifier){ - if ((stream == null) || (out == null)) { - throw new AssertionError("null streams not allowed"); - } - - this.reader = new BufferedReader(new InputStreamReader(stream)); - this.out = out; - this.identifier = identifier; - this.setName("Stream Copier"); - this.setDaemon(true); - } - - public void run() { - try { - StringBuffer buf = new StringBuffer(); - String line = null; - - while ((line = reader.readLine()) != null) { - if (identifier != null) { - line = identifier + line; - } - - if (false == StringUtils.isBlank(line)) { - buf.append(line).append(SystemUtils.LINE_SEPARATOR); - } - } - - out.write(buf.toString().getBytes()); - out.flush(); - } catch (IOException ioe) { - //ignore - } finally { - IOUtils.closeQuietly(reader); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.cmd; + +//~--- non-JDK imports -------------------------------------------------------- + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.SystemUtils; + +/** + * A simple thread that copies one stream to another. Useful for copying a process's output/error streams to this + * process's output/error streams. + */ +public class StreamCopier extends Thread { + + protected final String identifier; + protected final OutputStream out; + protected final BufferedReader reader; + + public StreamCopier(InputStream stream, OutputStream out){ + this(stream, out, null); + } + + public StreamCopier(InputStream stream, OutputStream out, String identifier){ + if ((stream == null) || (out == null)) { + throw new AssertionError("null streams not allowed"); + } + + this.reader = new BufferedReader(new InputStreamReader(stream)); + this.out = out; + this.identifier = identifier; + this.setName("Stream Copier"); + this.setDaemon(true); + } + + public void run() { + try { + StringBuffer buf = new StringBuffer(); + String line = null; + + while ((line = reader.readLine()) != null) { + if (identifier != null) { + line = identifier + line; + } + + if (false == StringUtils.isBlank(line)) { + buf.append(line).append(SystemUtils.LINE_SEPARATOR); + } + } + + out.write(buf.toString().getBytes()); + out.flush(); + } catch (IOException ioe) { + //ignore + } finally { + IOUtils.closeQuietly(reader); + } + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/Code.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/Code.java index 1ab76d27..0ce47576 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/Code.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/Code.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.code; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/ResourceBundleUtil.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/ResourceBundleUtil.java index e81af881..074bde32 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/ResourceBundleUtil.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/code/ResourceBundleUtil.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.code; import java.text.MessageFormat; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/JavaSourceCompiler.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/JavaSourceCompiler.java index ef9a0a2b..b29e148e 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/JavaSourceCompiler.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/JavaSourceCompiler.java @@ -1,11 +1,25 @@ -package com.alibaba.otter.shared.common.utils.compile; - -import com.alibaba.otter.shared.common.utils.compile.model.JavaSource; - -public interface JavaSourceCompiler { - - Class compile(String sourceString); - - Class compile(JavaSource javaSource); - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile; + +import com.alibaba.otter.shared.common.utils.compile.model.JavaSource; + +public interface JavaSourceCompiler { + + Class compile(String sourceString); + + Class compile(JavaSource javaSource); + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/CompileExprException.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/CompileExprException.java index 2a7caa02..6f9a93ee 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/CompileExprException.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/CompileExprException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.compile.exception; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/JdkCompileException.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/JdkCompileException.java index 2e15229a..6c8ce3f9 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/JdkCompileException.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/exception/JdkCompileException.java @@ -1,78 +1,92 @@ -package com.alibaba.otter.shared.common.utils.compile.exception; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.tools.DiagnosticCollector; -import javax.tools.JavaFileObject; - -/** - * @author wenshao - */ -public class JdkCompileException extends Exception { - - private static final long serialVersionUID = 1L; - - private Set classNames; - private transient DiagnosticCollector diagnostics; - - private String source; - - public JdkCompileException(String message, Set qualifiedClassNames, Throwable cause, - DiagnosticCollector diagnostics){ - super(message, cause); - setClassNames(qualifiedClassNames); - setDiagnostics(diagnostics); - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public JdkCompileException(String message, Set qualifiedClassNames, - DiagnosticCollector diagnostics){ - super(message); - setClassNames(qualifiedClassNames); - setDiagnostics(diagnostics); - } - - public JdkCompileException(Set qualifiedClassNames, Throwable cause, - DiagnosticCollector diagnostics){ - super(cause); - setClassNames(qualifiedClassNames); - setDiagnostics(diagnostics); - } - - private void setClassNames(Set qualifiedClassNames) { - // create a new HashSet because the set passed in may not - // be Serializable. For example, Map.keySet() returns a non-Serializable - // set. - classNames = new HashSet(qualifiedClassNames); - } - - private void setDiagnostics(DiagnosticCollector diagnostics) { - this.diagnostics = diagnostics; - } - - /** - * Gets the diagnostics collected by this exception. - * - * @return this exception's diagnostics - */ - public DiagnosticCollector getDiagnostics() { - return diagnostics; - } - - /** - * @return The name of the classes whose compilation caused the compile exception - */ - public Collection getClassNames() { - return Collections.unmodifiableSet(classNames); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile.exception; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.tools.DiagnosticCollector; +import javax.tools.JavaFileObject; + +/** + * @author wenshao + */ +public class JdkCompileException extends Exception { + + private static final long serialVersionUID = 1L; + + private Set classNames; + private transient DiagnosticCollector diagnostics; + + private String source; + + public JdkCompileException(String message, Set qualifiedClassNames, Throwable cause, + DiagnosticCollector diagnostics){ + super(message, cause); + setClassNames(qualifiedClassNames); + setDiagnostics(diagnostics); + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public JdkCompileException(String message, Set qualifiedClassNames, + DiagnosticCollector diagnostics){ + super(message); + setClassNames(qualifiedClassNames); + setDiagnostics(diagnostics); + } + + public JdkCompileException(Set qualifiedClassNames, Throwable cause, + DiagnosticCollector diagnostics){ + super(cause); + setClassNames(qualifiedClassNames); + setDiagnostics(diagnostics); + } + + private void setClassNames(Set qualifiedClassNames) { + // create a new HashSet because the set passed in may not + // be Serializable. For example, Map.keySet() returns a non-Serializable + // set. + classNames = new HashSet(qualifiedClassNames); + } + + private void setDiagnostics(DiagnosticCollector diagnostics) { + this.diagnostics = diagnostics; + } + + /** + * Gets the diagnostics collected by this exception. + * + * @return this exception's diagnostics + */ + public DiagnosticCollector getDiagnostics() { + return diagnostics; + } + + /** + * @return The name of the classes whose compilation caused the compile exception + */ + public Collection getClassNames() { + return Collections.unmodifiableSet(classNames); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompileTask.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompileTask.java index 3cdfe2e9..7ac52b42 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompileTask.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompileTask.java @@ -1,157 +1,171 @@ -package com.alibaba.otter.shared.common.utils.compile.impl; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.tools.DiagnosticCollector; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; -import javax.tools.StandardLocation; -import javax.tools.ToolProvider; -import javax.tools.JavaCompiler.CompilationTask; - -import com.alibaba.otter.shared.common.utils.compile.exception.JdkCompileException; -import com.alibaba.otter.shared.common.utils.compile.model.JavaFileManagerImpl; -import com.alibaba.otter.shared.common.utils.compile.model.JavaFileObjectImpl; -import com.alibaba.otter.shared.common.utils.compile.model.JdkCompilerClassLoader; - -public class JdkCompileTask { - - public static final String JAVA_EXTENSION = ".java"; - - private final JdkCompilerClassLoader classLoader; - - private final JavaCompiler compiler; - - private final List options; - - private DiagnosticCollector diagnostics; - - private JavaFileManagerImpl javaFileManager; - - public JdkCompileTask(JdkCompilerClassLoader classLoader, Iterable options){ - compiler = ToolProvider.getSystemJavaCompiler(); - if (compiler == null) { - throw new IllegalStateException("Cannot find the system Java compiler. " - + "Check that your class path includes tools.jar"); - } - - this.classLoader = classLoader; - ClassLoader loader = classLoader.getParent(); - diagnostics = new DiagnosticCollector(); - final StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); - - if (loader instanceof URLClassLoader - && (!loader.getClass().getName().equalsIgnoreCase("sun.misc.Launcher$AppClassLoader"))) { - try { - URLClassLoader urlClassLoader = (URLClassLoader) loader; - - List path = new ArrayList(); - for (URL url : urlClassLoader.getURLs()) { - File file = new File(url.getFile()); - path.add(file); - } - - fileManager.setLocation(StandardLocation.CLASS_PATH, path); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - javaFileManager = new JavaFileManagerImpl(fileManager, classLoader); - this.options = new ArrayList(); - if (options != null) { // make a save copy of input options - for (String option : options) { - this.options.add(option); - } - } - } - - public synchronized Class compile(final String className, final CharSequence javaSource, - final DiagnosticCollector diagnosticsList) - throws JdkCompileException, - ClassCastException { - if (diagnosticsList != null) { - diagnostics = diagnosticsList; - } else { - diagnostics = new DiagnosticCollector(); - } - - Map classes = new HashMap(1); - classes.put(className, javaSource); - - Map compiled = compile(classes, diagnosticsList); - Class newClass = compiled.get(className); - return newClass; - } - - public synchronized Map compile(final Map classes, - final DiagnosticCollector diagnosticsList) - throws JdkCompileException { - Map compiled = new HashMap(); - - List sources = new ArrayList(); - for (Entry entry : classes.entrySet()) { - String qualifiedClassName = entry.getKey(); - CharSequence javaSource = entry.getValue(); - if (javaSource != null) { - final int dotPos = qualifiedClassName.lastIndexOf('.'); - final String className = dotPos == -1 ? qualifiedClassName : qualifiedClassName.substring(dotPos + 1); - final String packageName = dotPos == -1 ? "" : qualifiedClassName.substring(0, dotPos); - final JavaFileObjectImpl source = new JavaFileObjectImpl(className, javaSource); - sources.add(source); - javaFileManager.putFileForInput(StandardLocation.SOURCE_PATH, packageName, className + JAVA_EXTENSION, - source); - } - } - - // Get a CompliationTask from the compiler and compile the sources - final CompilationTask task = compiler.getTask(null, javaFileManager, diagnostics, options, null, sources); - final Boolean result = task.call(); - if (result == null || !result.booleanValue()) { - throw new JdkCompileException("Compilation failed.", classes.keySet(), diagnostics); - } - - try { - // For each class name in the inpput map, get its compiled class and put it in the output map - for (String qualifiedClassName : classes.keySet()) { - final Class newClass = loadClass(qualifiedClassName); - compiled.put(qualifiedClassName, (Class) newClass); - } - - return compiled; - } catch (ClassNotFoundException e) { - throw new JdkCompileException(classes.keySet(), e, diagnostics); - } catch (IllegalArgumentException e) { - throw new JdkCompileException(classes.keySet(), e, diagnostics); - } catch (SecurityException e) { - throw new JdkCompileException(classes.keySet(), e, diagnostics); - } - } - - public Class loadClass(final String qualifiedClassName) throws ClassNotFoundException { - return (Class) classLoader.loadClass(qualifiedClassName); - } - - public static URI toURI(String name) { - try { - return new URI(name); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - - public ClassLoader getClassLoader() { - return javaFileManager.getClassLoader(); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile.impl; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.tools.DiagnosticCollector; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.StandardJavaFileManager; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; +import javax.tools.JavaCompiler.CompilationTask; + +import com.alibaba.otter.shared.common.utils.compile.exception.JdkCompileException; +import com.alibaba.otter.shared.common.utils.compile.model.JavaFileManagerImpl; +import com.alibaba.otter.shared.common.utils.compile.model.JavaFileObjectImpl; +import com.alibaba.otter.shared.common.utils.compile.model.JdkCompilerClassLoader; + +public class JdkCompileTask { + + public static final String JAVA_EXTENSION = ".java"; + + private final JdkCompilerClassLoader classLoader; + + private final JavaCompiler compiler; + + private final List options; + + private DiagnosticCollector diagnostics; + + private JavaFileManagerImpl javaFileManager; + + public JdkCompileTask(JdkCompilerClassLoader classLoader, Iterable options){ + compiler = ToolProvider.getSystemJavaCompiler(); + if (compiler == null) { + throw new IllegalStateException("Cannot find the system Java compiler. " + + "Check that your class path includes tools.jar"); + } + + this.classLoader = classLoader; + ClassLoader loader = classLoader.getParent(); + diagnostics = new DiagnosticCollector(); + final StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); + + if (loader instanceof URLClassLoader + && (!loader.getClass().getName().equalsIgnoreCase("sun.misc.Launcher$AppClassLoader"))) { + try { + URLClassLoader urlClassLoader = (URLClassLoader) loader; + + List path = new ArrayList(); + for (URL url : urlClassLoader.getURLs()) { + File file = new File(url.getFile()); + path.add(file); + } + + fileManager.setLocation(StandardLocation.CLASS_PATH, path); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + javaFileManager = new JavaFileManagerImpl(fileManager, classLoader); + this.options = new ArrayList(); + if (options != null) { // make a save copy of input options + for (String option : options) { + this.options.add(option); + } + } + } + + public synchronized Class compile(final String className, final CharSequence javaSource, + final DiagnosticCollector diagnosticsList) + throws JdkCompileException, + ClassCastException { + if (diagnosticsList != null) { + diagnostics = diagnosticsList; + } else { + diagnostics = new DiagnosticCollector(); + } + + Map classes = new HashMap(1); + classes.put(className, javaSource); + + Map compiled = compile(classes, diagnosticsList); + Class newClass = compiled.get(className); + return newClass; + } + + public synchronized Map compile(final Map classes, + final DiagnosticCollector diagnosticsList) + throws JdkCompileException { + Map compiled = new HashMap(); + + List sources = new ArrayList(); + for (Entry entry : classes.entrySet()) { + String qualifiedClassName = entry.getKey(); + CharSequence javaSource = entry.getValue(); + if (javaSource != null) { + final int dotPos = qualifiedClassName.lastIndexOf('.'); + final String className = dotPos == -1 ? qualifiedClassName : qualifiedClassName.substring(dotPos + 1); + final String packageName = dotPos == -1 ? "" : qualifiedClassName.substring(0, dotPos); + final JavaFileObjectImpl source = new JavaFileObjectImpl(className, javaSource); + sources.add(source); + javaFileManager.putFileForInput(StandardLocation.SOURCE_PATH, packageName, className + JAVA_EXTENSION, + source); + } + } + + // Get a CompliationTask from the compiler and compile the sources + final CompilationTask task = compiler.getTask(null, javaFileManager, diagnostics, options, null, sources); + final Boolean result = task.call(); + if (result == null || !result.booleanValue()) { + throw new JdkCompileException("Compilation failed.", classes.keySet(), diagnostics); + } + + try { + // For each class name in the inpput map, get its compiled class and put it in the output map + for (String qualifiedClassName : classes.keySet()) { + final Class newClass = loadClass(qualifiedClassName); + compiled.put(qualifiedClassName, (Class) newClass); + } + + return compiled; + } catch (ClassNotFoundException e) { + throw new JdkCompileException(classes.keySet(), e, diagnostics); + } catch (IllegalArgumentException e) { + throw new JdkCompileException(classes.keySet(), e, diagnostics); + } catch (SecurityException e) { + throw new JdkCompileException(classes.keySet(), e, diagnostics); + } + } + + public Class loadClass(final String qualifiedClassName) throws ClassNotFoundException { + return (Class) classLoader.loadClass(qualifiedClassName); + } + + public static URI toURI(String name) { + try { + return new URI(name); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + + public ClassLoader getClassLoader() { + return javaFileManager.getClassLoader(); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompiler.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompiler.java index 8b06c564..3a1b5504 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompiler.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/impl/JdkCompiler.java @@ -1,54 +1,68 @@ -package com.alibaba.otter.shared.common.utils.compile.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.tools.DiagnosticCollector; -import javax.tools.JavaFileObject; - -import com.alibaba.otter.shared.common.utils.compile.JavaSourceCompiler; -import com.alibaba.otter.shared.common.utils.compile.exception.CompileExprException; -import com.alibaba.otter.shared.common.utils.compile.exception.JdkCompileException; -import com.alibaba.otter.shared.common.utils.compile.model.JavaSource; -import com.alibaba.otter.shared.common.utils.compile.model.JdkCompilerClassLoader; - -public class JdkCompiler implements JavaSourceCompiler { - - private List options; - - public JdkCompiler(){ - options = new ArrayList(); - options.add("-target"); - options.add("1.6"); - } - - public Class compile(String sourceString) { - JavaSource source = new JavaSource(sourceString); - return compile(source); - } - - public Class compile(JavaSource javaSource) { - try { - - final DiagnosticCollector errs = new DiagnosticCollector(); - JdkCompileTask compileTask = new JdkCompileTask( - new JdkCompilerClassLoader(this.getClass().getClassLoader()), - options); - String fullName = javaSource.getPackageName() + "." + javaSource.getClassName(); - Class newClass = compileTask.compile(fullName, javaSource.getSource(), errs); - return newClass; - } catch (JdkCompileException ex) { - DiagnosticCollector diagnostics = ex.getDiagnostics(); - throw new CompileExprException("compile error, source : \n" + javaSource + ", " - + diagnostics.getDiagnostics(), ex); - } catch (Exception ex) { - throw new CompileExprException("compile error, source : \n" + javaSource, ex); - } - - } - - public void setOptions(List options) { - this.options = options; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.tools.DiagnosticCollector; +import javax.tools.JavaFileObject; + +import com.alibaba.otter.shared.common.utils.compile.JavaSourceCompiler; +import com.alibaba.otter.shared.common.utils.compile.exception.CompileExprException; +import com.alibaba.otter.shared.common.utils.compile.exception.JdkCompileException; +import com.alibaba.otter.shared.common.utils.compile.model.JavaSource; +import com.alibaba.otter.shared.common.utils.compile.model.JdkCompilerClassLoader; + +public class JdkCompiler implements JavaSourceCompiler { + + private List options; + + public JdkCompiler(){ + options = new ArrayList(); + options.add("-target"); + options.add("1.6"); + } + + public Class compile(String sourceString) { + JavaSource source = new JavaSource(sourceString); + return compile(source); + } + + public Class compile(JavaSource javaSource) { + try { + + final DiagnosticCollector errs = new DiagnosticCollector(); + JdkCompileTask compileTask = new JdkCompileTask( + new JdkCompilerClassLoader(this.getClass().getClassLoader()), + options); + String fullName = javaSource.getPackageName() + "." + javaSource.getClassName(); + Class newClass = compileTask.compile(fullName, javaSource.getSource(), errs); + return newClass; + } catch (JdkCompileException ex) { + DiagnosticCollector diagnostics = ex.getDiagnostics(); + throw new CompileExprException("compile error, source : \n" + javaSource + ", " + + diagnostics.getDiagnostics(), ex); + } catch (Exception ex) { + throw new CompileExprException("compile error, source : \n" + javaSource, ex); + } + + } + + public void setOptions(List options) { + this.options = options; + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileManagerImpl.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileManagerImpl.java index 834dd068..71c3b836 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileManagerImpl.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileManagerImpl.java @@ -1,114 +1,128 @@ -package com.alibaba.otter.shared.common.utils.compile.model; - -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.tools.FileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.StandardLocation; -import javax.tools.JavaFileObject.Kind; - -import com.alibaba.otter.shared.common.utils.compile.impl.JdkCompileTask; - -public class JavaFileManagerImpl extends ForwardingJavaFileManager { - - private final JdkCompilerClassLoader classLoader; - - private final Map fileObjects = new HashMap(); - - public JavaFileManagerImpl(JavaFileManager fileManager, JdkCompilerClassLoader classLoader){ - super(fileManager); - this.classLoader = classLoader; - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - @Override - public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { - FileObject o = fileObjects.get(uri(location, packageName, relativeName)); - - if (o != null) { - return o; - } - - return super.getFileForInput(location, packageName, relativeName); - } - - public void putFileForInput(StandardLocation location, String packageName, String relativeName, JavaFileObject file) { - fileObjects.put(uri(location, packageName, relativeName), file); - } - - private URI uri(Location location, String packageName, String relativeName) { - return JdkCompileTask.toURI(location.getName() + '/' + packageName + '/' + relativeName); - } - - @Override - public JavaFileObject getJavaFileForOutput(Location location, String qualifiedName, Kind kind, FileObject outputFile) - throws IOException { - JavaFileObject file = new JavaFileObjectImpl(qualifiedName, kind); - classLoader.add(qualifiedName, file); - return file; - } - - @Override - public ClassLoader getClassLoader(JavaFileManager.Location location) { - return classLoader; - } - - @Override - public String inferBinaryName(Location loc, JavaFileObject file) { - if (file instanceof JavaFileObjectImpl) { - return file.getName(); - } - - return super.inferBinaryName(loc, file); - } - - @Override - public Iterable list(Location location, String packageName, Set kinds, boolean recurse) - throws IOException { - Iterable result = super.list(location, packageName, kinds, recurse); - - ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - List urlList = new ArrayList(); - Enumeration e = contextClassLoader.getResources("com"); - while (e.hasMoreElements()) { - urlList.add(e.nextElement()); - } - - ArrayList files = new ArrayList(); - - if (location == StandardLocation.CLASS_PATH && kinds.contains(JavaFileObject.Kind.CLASS)) { - for (JavaFileObject file : fileObjects.values()) { - if (file.getKind() == Kind.CLASS && file.getName().startsWith(packageName)) { - files.add(file); - } - } - - files.addAll(classLoader.files()); - } else if (location == StandardLocation.SOURCE_PATH && kinds.contains(JavaFileObject.Kind.SOURCE)) { - for (JavaFileObject file : fileObjects.values()) { - if (file.getKind() == Kind.SOURCE && file.getName().startsWith(packageName)) { - files.add(file); - } - } - } - - for (JavaFileObject file : result) { - files.add(file); - } - - return files; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile.model; + +import java.io.IOException; +import java.net.URI; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.tools.FileObject; +import javax.tools.ForwardingJavaFileManager; +import javax.tools.JavaFileManager; +import javax.tools.JavaFileObject; +import javax.tools.StandardLocation; +import javax.tools.JavaFileObject.Kind; + +import com.alibaba.otter.shared.common.utils.compile.impl.JdkCompileTask; + +public class JavaFileManagerImpl extends ForwardingJavaFileManager { + + private final JdkCompilerClassLoader classLoader; + + private final Map fileObjects = new HashMap(); + + public JavaFileManagerImpl(JavaFileManager fileManager, JdkCompilerClassLoader classLoader){ + super(fileManager); + this.classLoader = classLoader; + } + + public ClassLoader getClassLoader() { + return classLoader; + } + + @Override + public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { + FileObject o = fileObjects.get(uri(location, packageName, relativeName)); + + if (o != null) { + return o; + } + + return super.getFileForInput(location, packageName, relativeName); + } + + public void putFileForInput(StandardLocation location, String packageName, String relativeName, JavaFileObject file) { + fileObjects.put(uri(location, packageName, relativeName), file); + } + + private URI uri(Location location, String packageName, String relativeName) { + return JdkCompileTask.toURI(location.getName() + '/' + packageName + '/' + relativeName); + } + + @Override + public JavaFileObject getJavaFileForOutput(Location location, String qualifiedName, Kind kind, FileObject outputFile) + throws IOException { + JavaFileObject file = new JavaFileObjectImpl(qualifiedName, kind); + classLoader.add(qualifiedName, file); + return file; + } + + @Override + public ClassLoader getClassLoader(JavaFileManager.Location location) { + return classLoader; + } + + @Override + public String inferBinaryName(Location loc, JavaFileObject file) { + if (file instanceof JavaFileObjectImpl) { + return file.getName(); + } + + return super.inferBinaryName(loc, file); + } + + @Override + public Iterable list(Location location, String packageName, Set kinds, boolean recurse) + throws IOException { + Iterable result = super.list(location, packageName, kinds, recurse); + + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); + List urlList = new ArrayList(); + Enumeration e = contextClassLoader.getResources("com"); + while (e.hasMoreElements()) { + urlList.add(e.nextElement()); + } + + ArrayList files = new ArrayList(); + + if (location == StandardLocation.CLASS_PATH && kinds.contains(JavaFileObject.Kind.CLASS)) { + for (JavaFileObject file : fileObjects.values()) { + if (file.getKind() == Kind.CLASS && file.getName().startsWith(packageName)) { + files.add(file); + } + } + + files.addAll(classLoader.files()); + } else if (location == StandardLocation.SOURCE_PATH && kinds.contains(JavaFileObject.Kind.SOURCE)) { + for (JavaFileObject file : fileObjects.values()) { + if (file.getKind() == Kind.SOURCE && file.getName().startsWith(packageName)) { + files.add(file); + } + } + } + + for (JavaFileObject file : result) { + files.add(file); + } + + return files; + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileObjectImpl.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileObjectImpl.java index 00ece3bc..ede6e2af 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileObjectImpl.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaFileObjectImpl.java @@ -1,58 +1,72 @@ -package com.alibaba.otter.shared.common.utils.compile.model; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; - -import javax.tools.SimpleJavaFileObject; - -import com.alibaba.otter.shared.common.utils.compile.impl.JdkCompileTask; - -public final class JavaFileObjectImpl extends SimpleJavaFileObject { - - // If kind == CLASS, this stores byte code from openOutputStream - private ByteArrayOutputStream byteCode = new ByteArrayOutputStream(); - - // if kind == SOURCE, this contains the source text - private final CharSequence source; - - public JavaFileObjectImpl(final String baseName, final CharSequence source){ - super(JdkCompileTask.toURI(baseName + JdkCompileTask.JAVA_EXTENSION), Kind.SOURCE); - this.source = source; - } - - public JavaFileObjectImpl(final String name, final Kind kind){ - super(JdkCompileTask.toURI(name), kind); - source = null; - } - - public JavaFileObjectImpl(URI uri, Kind kind){ - super(uri, kind); - source = null; - } - - @Override - public CharSequence getCharContent(final boolean ignoreEncodingErrors) throws UnsupportedOperationException { - if (source == null) { - throw new UnsupportedOperationException(); - } - - return source; - } - - @Override - public InputStream openInputStream() { - return new ByteArrayInputStream(getByteCode()); - } - - @Override - public OutputStream openOutputStream() { - return byteCode; - } - - public byte[] getByteCode() { - return byteCode.toByteArray(); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.compile.model; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; + +import javax.tools.SimpleJavaFileObject; + +import com.alibaba.otter.shared.common.utils.compile.impl.JdkCompileTask; + +public final class JavaFileObjectImpl extends SimpleJavaFileObject { + + // If kind == CLASS, this stores byte code from openOutputStream + private ByteArrayOutputStream byteCode = new ByteArrayOutputStream(); + + // if kind == SOURCE, this contains the source text + private final CharSequence source; + + public JavaFileObjectImpl(final String baseName, final CharSequence source){ + super(JdkCompileTask.toURI(baseName + JdkCompileTask.JAVA_EXTENSION), Kind.SOURCE); + this.source = source; + } + + public JavaFileObjectImpl(final String name, final Kind kind){ + super(JdkCompileTask.toURI(name), kind); + source = null; + } + + public JavaFileObjectImpl(URI uri, Kind kind){ + super(uri, kind); + source = null; + } + + @Override + public CharSequence getCharContent(final boolean ignoreEncodingErrors) throws UnsupportedOperationException { + if (source == null) { + throw new UnsupportedOperationException(); + } + + return source; + } + + @Override + public InputStream openInputStream() { + return new ByteArrayInputStream(getByteCode()); + } + + @Override + public OutputStream openOutputStream() { + return byteCode; + } + + public byte[] getByteCode() { + return byteCode.toByteArray(); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaSource.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaSource.java index ee7ad438..ce785b8c 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaSource.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JavaSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.compile.model; import org.apache.commons.lang.StringUtils; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JdkCompilerClassLoader.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JdkCompilerClassLoader.java index f2a9cd89..0f8481e8 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JdkCompilerClassLoader.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/compile/model/JdkCompilerClassLoader.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.compile.model; import java.io.ByteArrayInputStream; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/DefaultExtensionFactory.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/DefaultExtensionFactory.java index 727c0e5d..5bc19e46 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/DefaultExtensionFactory.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/DefaultExtensionFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.extension; import org.apache.commons.lang.StringUtils; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/ExtensionFactory.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/ExtensionFactory.java index cdca68f5..82af7cd2 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/ExtensionFactory.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/ExtensionFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.extension; import com.alibaba.otter.shared.common.model.config.data.ExtensionData; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassFilter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassFilter.java index 8ac1210a..47f514ba 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassFilter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassFilter.java @@ -1,6 +1,20 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -public interface ClassFilter { - - boolean accept(Class clazz); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +public interface ClassFilter { + + boolean accept(Class clazz); +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassNameUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassNameUtils.java index bd819960..09718bb0 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassNameUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassNameUtils.java @@ -1,79 +1,93 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -/** - * class名字转换处理类 - * - * @author jianghang 2012-10-23 下午04:37:48 - * @version 4.1.0 - */ -public class ClassNameUtils { - - /** - * Convert a class name with underscores to the corresponding column name using "_". A name like "CustomerNumber" - * class name would match a "CUSTOMER_NUMBER". - * - * @param name the class name to be converted - * @return the name using "_" - */ - public static String convertClassNameToUnderscoreName(String name) { - StringBuilder result = new StringBuilder(); - - if (name != null) { - int len = name.length(); - - if (len > 0) { - result.append(name.charAt(0)); - - for (int i = 1; i < len; i++) { - if (true == Character.isUpperCase(name.charAt(i))) { - result.append('_'); - } - - result.append(name.charAt(i)); - } - } - } - - return result.toString().toUpperCase(); - } - - /** - * Convert a column name with underscores to the corresponding class name using "camel case". A name like - * "customer_number" would match a "CustomerNumber" class name. - * - * @param name the column name to be converted - * @return the name using "camel case" - */ - public static String convertUnderscoreNameToClassName(String name) { - StringBuffer result = new StringBuffer(); - boolean nextIsUpper = false; - - if (name != null) { - int len = name.length(); - - if (len > 0) { - String s = String.valueOf(name.charAt(0)); - - result.append(s.toUpperCase()); - - for (int i = 1; i < len; i++) { - s = String.valueOf(name.charAt(i)); - - if ("_".equals(s)) { - nextIsUpper = true; - } else { - if (nextIsUpper) { - result.append(s.toUpperCase()); - nextIsUpper = false; - } else { - result.append(s.toLowerCase()); - } - } - } - } - } - - return result.toString(); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +/** + * class名字转换处理类 + * + * @author jianghang 2012-10-23 下午04:37:48 + * @version 4.1.0 + */ +public class ClassNameUtils { + + /** + * Convert a class name with underscores to the corresponding column name using "_". A name like "CustomerNumber" + * class name would match a "CUSTOMER_NUMBER". + * + * @param name the class name to be converted + * @return the name using "_" + */ + public static String convertClassNameToUnderscoreName(String name) { + StringBuilder result = new StringBuilder(); + + if (name != null) { + int len = name.length(); + + if (len > 0) { + result.append(name.charAt(0)); + + for (int i = 1; i < len; i++) { + if (true == Character.isUpperCase(name.charAt(i))) { + result.append('_'); + } + + result.append(name.charAt(i)); + } + } + } + + return result.toString().toUpperCase(); + } + + /** + * Convert a column name with underscores to the corresponding class name using "camel case". A name like + * "customer_number" would match a "CustomerNumber" class name. + * + * @param name the column name to be converted + * @return the name using "camel case" + */ + public static String convertUnderscoreNameToClassName(String name) { + StringBuffer result = new StringBuffer(); + boolean nextIsUpper = false; + + if (name != null) { + int len = name.length(); + + if (len > 0) { + String s = String.valueOf(name.charAt(0)); + + result.append(s.toUpperCase()); + + for (int i = 1; i < len; i++) { + s = String.valueOf(name.charAt(i)); + + if ("_".equals(s)) { + nextIsUpper = true; + } else { + if (nextIsUpper) { + result.append(s.toUpperCase()); + nextIsUpper = false; + } else { + result.append(s.toLowerCase()); + } + } + } + } + } + + return result.toString(); + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassScanner.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassScanner.java index 41bde89b..c4321237 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassScanner.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClassScanner.java @@ -1,12 +1,26 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -/** - * 用于扫描classpath下面和外部文件系统中类. - * - * @author jianghang 2012-10-23 下午04:36:53 - * @version 4.1.0 - */ -public interface ClassScanner { - - Class scan(String className); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +/** + * 用于扫描classpath下面和外部文件系统中类. + * + * @author jianghang 2012-10-23 下午04:36:53 + * @version 4.1.0 + */ +public interface ClassScanner { + + Class scan(String className); +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClasspathClassScanner.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClasspathClassScanner.java index 9ac74083..9a6a86cf 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClasspathClassScanner.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/ClasspathClassScanner.java @@ -1,25 +1,39 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Class path 扫描器 - * - * @author xiaoqing.zhouxq - */ -public class ClasspathClassScanner implements ClassScanner { - - private static final Logger logger = LoggerFactory.getLogger(ClasspathClassScanner.class); - - public Class scan(String className) { - try { - return Class.forName(className); - } catch (ClassNotFoundException e) { - logger.error("ERROR ## can not found this class ,the name = " + className); - } - - return null; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Class path 扫描器 + * + * @author xiaoqing.zhouxq + */ +public class ClasspathClassScanner implements ClassScanner { + + private static final Logger logger = LoggerFactory.getLogger(ClasspathClassScanner.class); + + public Class scan(String className) { + try { + return Class.forName(className); + } catch (ClassNotFoundException e) { + logger.error("ERROR ## can not found this class ,the name = " + className); + } + + return null; + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassLoader.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassLoader.java index 1fba1473..5efc2eab 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassLoader.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassLoader.java @@ -1,71 +1,85 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 基于文件系统的classloader. - * - * @author xiaoqing.zhouxq - */ -public class FileSystemClassLoader extends ClassLoader { - - private static final Logger logger = LoggerFactory.getLogger(FileSystemClassLoader.class); - private String rootDir; - - public FileSystemClassLoader(String rootDir, ClassLoader parent){ - super(parent); - this.rootDir = rootDir; - } - - /* - * (non-Javadoc) - * @see java.lang.ClassLoader#findClass(java.lang.String) - */ - protected Class findClass(String name) throws ClassNotFoundException { - byte[] classData = getClassData(name); - if (classData == null) { - throw new ClassNotFoundException(); - } else { - return defineClass(name, classData, 0, classData.length); - } - } - - private byte[] getClassData(String className) { - String path = classNameToPath(className); - InputStream ins = null; - try { - ins = new FileInputStream(path); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - int bufferSize = 4096; - byte[] buffer = new byte[bufferSize]; - int bytesNumRead = 0; - while ((bytesNumRead = ins.read(buffer)) != -1) { - baos.write(buffer, 0, bytesNumRead); - } - return baos.toByteArray(); - } catch (IOException e) { - logger.error("ERROR ## get class data has an error", e); - } finally { - if (ins != null) { - try { - ins.close(); - } catch (IOException e) { - logger.error("ERROR ## close inputstream has an error", e); - } - } - } - return null; - } - - private String classNameToPath(String className) { - return rootDir + File.separatorChar + className.replace('.', File.separatorChar) + ".class"; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 基于文件系统的classloader. + * + * @author xiaoqing.zhouxq + */ +public class FileSystemClassLoader extends ClassLoader { + + private static final Logger logger = LoggerFactory.getLogger(FileSystemClassLoader.class); + private String rootDir; + + public FileSystemClassLoader(String rootDir, ClassLoader parent){ + super(parent); + this.rootDir = rootDir; + } + + /* + * (non-Javadoc) + * @see java.lang.ClassLoader#findClass(java.lang.String) + */ + protected Class findClass(String name) throws ClassNotFoundException { + byte[] classData = getClassData(name); + if (classData == null) { + throw new ClassNotFoundException(); + } else { + return defineClass(name, classData, 0, classData.length); + } + } + + private byte[] getClassData(String className) { + String path = classNameToPath(className); + InputStream ins = null; + try { + ins = new FileInputStream(path); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int bufferSize = 4096; + byte[] buffer = new byte[bufferSize]; + int bytesNumRead = 0; + while ((bytesNumRead = ins.read(buffer)) != -1) { + baos.write(buffer, 0, bytesNumRead); + } + return baos.toByteArray(); + } catch (IOException e) { + logger.error("ERROR ## get class data has an error", e); + } finally { + if (ins != null) { + try { + ins.close(); + } catch (IOException e) { + logger.error("ERROR ## close inputstream has an error", e); + } + } + } + return null; + } + + private String classNameToPath(String className) { + return rootDir + File.separatorChar + className.replace('.', File.separatorChar) + ".class"; + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassScanner.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassScanner.java index d64b2db7..c973c8c4 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassScanner.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/classpath/FileSystemClassScanner.java @@ -1,138 +1,152 @@ -package com.alibaba.otter.shared.common.utils.extension.classpath; - -import java.io.File; -import java.io.IOException; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -/** - * 外部文件的class扫描器. - * - * @author xiaoqing.zhouxq - */ -public class FileSystemClassScanner implements InitializingBean, ClassScanner { - - private static final Logger logger = LoggerFactory.getLogger(FileSystemClassScanner.class); - - private static final String CLASS_FILE = ".class"; - private static final String JAR_FILE = ".jar"; - private String extendsDir; - private FileSystemClassLoader fileClassLoader; - - @Override - public void afterPropertiesSet() throws Exception { - this.fileClassLoader = new FileSystemClassLoader(extendsDir, this.getClass().getClassLoader()); - } - - public Class scan(String className) { - return findInDirectory(extendsDir, className); - } - - private Class findInDirectory(String dirStr, String className) { - File dir = StrToFile(dirStr); - File[] files = dir.listFiles(); - String rootPath = dir.getPath(); - for (File file : files) { - if (file.isFile()) { - String classFileName = file.getPath(); - if (classFileName.endsWith(CLASS_FILE)) { - String tempClassName = classFileName.substring(rootPath.length() - className.lastIndexOf("."), - classFileName.length() - CLASS_FILE.length()); - if (className.equals(pathToDot(tempClassName))) { - try { - return fileClassLoader.loadClass(className); - } catch (Exception ex) { - logger.warn("WARN ## load this class has an error,the fileName is = " + className, ex); - } - } - } else if (classFileName.endsWith(JAR_FILE)) { - // logger.info("INFO ## cannot scane filesystem's jar file"); - return scanInJar(classFileName, className); - } - } else if (file.isDirectory()) { - Class clz = findInDirectory(file.toString(), className); - if (clz != null) { - return clz; - } - } - } - - return null; - } - - private Class scanInJar(String jarFileName, String className) { - ZipFile zipfile = null; - - try { - zipfile = new ZipFile(jarFileName); - Enumeration zipenum = zipfile.entries(); - ZipEntry entry = null; - String tempClassName = null; - - while (zipenum.hasMoreElements()) { - entry = (ZipEntry) zipenum.nextElement(); - tempClassName = entry.getName(); - - if (tempClassName.endsWith(".class")) { - tempClassName = StringUtils.replace(FilenameUtils.removeExtension(tempClassName), "/", "."); - if (tempClassName.equals(className)) { - try { - return fileClassLoader.loadClass(className); - } catch (Exception ex) { - logger.warn("WARN ## load this class has an error,the fileName is = " + className, ex); - } - } - } - } - } catch (IOException ex) { - logger.error(ex.getMessage(), ex); - } finally { - if (zipfile != null) { - try { - zipfile.close(); - } catch (IOException ex) { - logger.warn(ex.getMessage(), ex); - } - } - } - return null; - } - - private File StrToFile(String dirString) { - File file = new File(dirString); - if (!file.exists()) { - file.mkdir(); - } - return file; - } - - private String pathToDot(String s) { - return s.replace('/', '.').replace('\\', '.'); - } - - public void setExtendsDir(String extendsDir) { - this.extendsDir = extendsDir; - - File dir = new File(extendsDir); - if (!dir.exists()) { - try { - FileUtils.forceMkdir(dir); - } catch (IOException e) { - logger.error("##ERROR", e); - } - } - } - - public void setFileClassLoader(FileSystemClassLoader fileClassLoader) { - this.fileClassLoader = fileClassLoader; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.extension.classpath; + +import java.io.File; +import java.io.IOException; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +/** + * 外部文件的class扫描器. + * + * @author xiaoqing.zhouxq + */ +public class FileSystemClassScanner implements InitializingBean, ClassScanner { + + private static final Logger logger = LoggerFactory.getLogger(FileSystemClassScanner.class); + + private static final String CLASS_FILE = ".class"; + private static final String JAR_FILE = ".jar"; + private String extendsDir; + private FileSystemClassLoader fileClassLoader; + + @Override + public void afterPropertiesSet() throws Exception { + this.fileClassLoader = new FileSystemClassLoader(extendsDir, this.getClass().getClassLoader()); + } + + public Class scan(String className) { + return findInDirectory(extendsDir, className); + } + + private Class findInDirectory(String dirStr, String className) { + File dir = StrToFile(dirStr); + File[] files = dir.listFiles(); + String rootPath = dir.getPath(); + for (File file : files) { + if (file.isFile()) { + String classFileName = file.getPath(); + if (classFileName.endsWith(CLASS_FILE)) { + String tempClassName = classFileName.substring(rootPath.length() - className.lastIndexOf("."), + classFileName.length() - CLASS_FILE.length()); + if (className.equals(pathToDot(tempClassName))) { + try { + return fileClassLoader.loadClass(className); + } catch (Exception ex) { + logger.warn("WARN ## load this class has an error,the fileName is = " + className, ex); + } + } + } else if (classFileName.endsWith(JAR_FILE)) { + // logger.info("INFO ## cannot scane filesystem's jar file"); + return scanInJar(classFileName, className); + } + } else if (file.isDirectory()) { + Class clz = findInDirectory(file.toString(), className); + if (clz != null) { + return clz; + } + } + } + + return null; + } + + private Class scanInJar(String jarFileName, String className) { + ZipFile zipfile = null; + + try { + zipfile = new ZipFile(jarFileName); + Enumeration zipenum = zipfile.entries(); + ZipEntry entry = null; + String tempClassName = null; + + while (zipenum.hasMoreElements()) { + entry = (ZipEntry) zipenum.nextElement(); + tempClassName = entry.getName(); + + if (tempClassName.endsWith(".class")) { + tempClassName = StringUtils.replace(FilenameUtils.removeExtension(tempClassName), "/", "."); + if (tempClassName.equals(className)) { + try { + return fileClassLoader.loadClass(className); + } catch (Exception ex) { + logger.warn("WARN ## load this class has an error,the fileName is = " + className, ex); + } + } + } + } + } catch (IOException ex) { + logger.error(ex.getMessage(), ex); + } finally { + if (zipfile != null) { + try { + zipfile.close(); + } catch (IOException ex) { + logger.warn(ex.getMessage(), ex); + } + } + } + return null; + } + + private File StrToFile(String dirString) { + File file = new File(dirString); + if (!file.exists()) { + file.mkdir(); + } + return file; + } + + private String pathToDot(String s) { + return s.replace('/', '.').replace('\\', '.'); + } + + public void setExtendsDir(String extendsDir) { + this.extendsDir = extendsDir; + + File dir = new File(extendsDir); + if (!dir.exists()) { + try { + FileUtils.forceMkdir(dir); + } catch (IOException e) { + logger.error("##ERROR", e); + } + } + } + + public void setFileClassLoader(FileSystemClassLoader fileClassLoader) { + this.fileClassLoader = fileClassLoader; + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/exceptions/ExtensionLoadException.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/exceptions/ExtensionLoadException.java index fc9132b3..f85c8208 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/exceptions/ExtensionLoadException.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/extension/exceptions/ExtensionLoadException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.extension.exceptions; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/lock/BooleanMutex.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/lock/BooleanMutex.java index c706f31c..0f0ba0e3 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/lock/BooleanMutex.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/lock/BooleanMutex.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.lock; import java.util.concurrent.TimeUnit; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlSchemaFilter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlSchemaFilter.java index 1b241882..10cf207a 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlSchemaFilter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlSchemaFilter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.meta; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlTableNameFilter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlTableNameFilter.java index 23752685..7370e5ab 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlTableNameFilter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlTableNameFilter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.meta; /** diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtils.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtils.java index ea3ddddc..4bb20ff6 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtils.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtils.java @@ -1,464 +1,478 @@ -package com.alibaba.otter.shared.common.utils.meta; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; -import org.apache.commons.lang.math.NumberUtils; -import org.apache.ddlutils.model.Column; -import org.apache.ddlutils.model.Table; -import org.apache.ddlutils.platform.DatabaseMetaDataWrapper; -import org.apache.ddlutils.platform.MetaDataColumnDescriptor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.core.ConnectionCallback; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.SingleColumnRowMapper; -import org.springframework.jdbc.support.JdbcUtils; -import org.springframework.util.Assert; - -/** - * copy from otter3.0 - * - * @author xiaoqing.zhouxq 2012-3-30 上午10:43:04 - * @author zebin.xuzb add filter for data - */ -public class DdlUtils { - - private static final Logger logger = LoggerFactory.getLogger(DdlUtils.class); - private static TableType[] SUPPORTED_TABLE_TYPES = new TableType[] { TableType.view, TableType.table }; - private final static Map _defaultSizes = new HashMap(); - - static { - _defaultSizes.put(new Integer(1), "254"); - _defaultSizes.put(new Integer(12), "254"); - _defaultSizes.put(new Integer(-1), "254"); - _defaultSizes.put(new Integer(-2), "254"); - _defaultSizes.put(new Integer(-3), "254"); - _defaultSizes.put(new Integer(-4), "254"); - _defaultSizes.put(new Integer(4), "32"); - _defaultSizes.put(new Integer(-5), "64"); - _defaultSizes.put(new Integer(7), "7,0"); - _defaultSizes.put(new Integer(6), "15,0"); - _defaultSizes.put(new Integer(8), "15,0"); - _defaultSizes.put(new Integer(3), "15,15"); - _defaultSizes.put(new Integer(2), "15,15"); - } - - /** - * !!! Only supports MySQL - */ - @SuppressWarnings("unchecked") - public static List findSchemas(JdbcTemplate jdbcTemplate, final String schemaPattern) { - try { - if (StringUtils.isEmpty(schemaPattern)) { - return jdbcTemplate.query("show databases", new SingleColumnRowMapper(String.class)); - } - return jdbcTemplate.query("show databases like ?", new Object[] { schemaPattern }, - new SingleColumnRowMapper(String.class)); - } catch (Exception e) { - logger.error(e.getMessage(), e); - return new ArrayList(); - } - } - - /** - * !!! Only supports MySQL - */ - public static List findSchemas(JdbcTemplate jdbcTemplate, final String schemaPattern, - final DdlSchemaFilter ddlSchemaFilter) { - List schemas = findSchemas(jdbcTemplate, schemaPattern); - if (ddlSchemaFilter == null) { - return schemas; - } - List filterSchemas = new ArrayList(); - for (String schema : schemas) { - if (ddlSchemaFilter.accept(schema)) { - filterSchemas.add(schema); - } - } - return filterSchemas; - } - - public static Table findTable(JdbcTemplate jdbcTemplate, final String catalogName, final String schemaName, - final String tableName) throws Exception { - return findTable(jdbcTemplate, catalogName, schemaName, tableName, null); - } - - public static Table findTable(final JdbcTemplate jdbcTemplate, final String catalogName, final String schemaName, - final String tableName, final DdlUtilsFilter filter) throws Exception { - return (Table) jdbcTemplate.execute(new ConnectionCallback() { - - public Object doInConnection(Connection con) throws SQLException, DataAccessException { - Table table = null; - DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper(); - - try { - if (filter != null) { - con = filter.filterConnection(con); - Assert.notNull(con); - } - DatabaseMetaData databaseMetaData = con.getMetaData(); - if (filter != null) { - databaseMetaData = filter.filterDataBaseMetaData(jdbcTemplate, con, databaseMetaData); - Assert.notNull(databaseMetaData); - } - - metaData.setMetaData(databaseMetaData); - metaData.setTableTypes(TableType.toStrings(SUPPORTED_TABLE_TYPES)); - String convertTableName = tableName; - if (databaseMetaData.storesUpperCaseIdentifiers()) { - metaData.setCatalog(catalogName.toUpperCase()); - metaData.setSchemaPattern(schemaName.toUpperCase()); - convertTableName = tableName.toUpperCase(); - } - if (databaseMetaData.storesLowerCaseIdentifiers()) { - metaData.setCatalog(catalogName.toLowerCase()); - metaData.setSchemaPattern(schemaName.toLowerCase()); - convertTableName = tableName.toLowerCase(); - } - - ResultSet tableData = null; - try { - tableData = metaData.getTables(convertTableName); - - while ((tableData != null) && tableData.next()) { - Map values = readColumns(tableData, initColumnsForTable()); - - table = readTable(metaData, values); - if (table.getName().equalsIgnoreCase(tableName)) { - break; - } - } - } finally { - JdbcUtils.closeResultSet(tableData); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(table); - - return table; - } - }); - } - - @SuppressWarnings("unchecked") - public static List findTables(final JdbcTemplate jdbcTemplate, final String catalogName, - final String schemaName, final String tableNamePattern, - final DdlUtilsFilter filter, final DdlTableNameFilter tableNameFilter) - throws Exception { - return (List
) jdbcTemplate.execute(new ConnectionCallback() { - - public Object doInConnection(Connection con) throws SQLException, DataAccessException { - List
tables = new ArrayList
(); - DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper(); - - try { - if (filter != null) { - con = filter.filterConnection(con); - Assert.notNull(con); - } - DatabaseMetaData databaseMetaData = con.getMetaData(); - if (filter != null) { - databaseMetaData = filter.filterDataBaseMetaData(jdbcTemplate, con, databaseMetaData); - Assert.notNull(databaseMetaData); - } - - metaData.setMetaData(databaseMetaData); - metaData.setTableTypes(TableType.toStrings(SUPPORTED_TABLE_TYPES)); - String convertTableName = tableNamePattern; - if (databaseMetaData.storesUpperCaseIdentifiers()) { - metaData.setCatalog(catalogName.toUpperCase()); - metaData.setSchemaPattern(schemaName.toUpperCase()); - convertTableName = tableNamePattern.toUpperCase(); - } - if (databaseMetaData.storesLowerCaseIdentifiers()) { - metaData.setCatalog(catalogName.toLowerCase()); - metaData.setSchemaPattern(schemaName.toLowerCase()); - convertTableName = tableNamePattern.toLowerCase(); - } - - ResultSet tableData = null; - try { - tableData = metaData.getTables(convertTableName); - - while ((tableData != null) && tableData.next()) { - Map values = readColumns(tableData, initColumnsForTable()); - - Table table = readTable(metaData, values); - if ((tableNameFilter == null) - || tableNameFilter.accept(catalogName, schemaName, table.getName())) { - tables.add(table); - } - } - } finally { - JdbcUtils.closeResultSet(tableData); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - - for (Table table : tables) { - makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(table); - } - - return tables; - } - }); - } - - /** - * Treat tables with no primary keys as a table with all primary keys. - */ - private static void makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(Table table) { - if ((table != null) && (table.getPrimaryKeyColumns() != null) && (table.getPrimaryKeyColumns().length == 0)) { - Column[] allCoumns = table.getColumns(); - - for (Column column : allCoumns) { - column.setPrimaryKey(true); - } - } - } - - private static Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { - String tableName = (String) values.get("TABLE_NAME"); - Table table = null; - - if ((tableName != null) && (tableName.length() > 0)) { - table = new Table(); - table.setName(tableName); - table.setType((String) values.get("TABLE_TYPE")); - table.setCatalog((String) values.get("TABLE_CAT")); - table.setSchema((String) values.get("TABLE_SCHEM")); - table.setDescription((String) values.get("REMARKS")); - table.addColumns(readColumns(metaData, tableName)); - - Collection primaryKeys = readPrimaryKeyNames(metaData, tableName); - - for (Object key : primaryKeys) { - Column col = table.findColumn((String) key, true); - - if (col != null) { - col.setPrimaryKey(true); - } else { - throw new NullPointerException( - String.format("%s pk %s is null - %s %s", - tableName, - key, - ToStringBuilder.reflectionToString(metaData, - ToStringStyle.SIMPLE_STYLE), - ToStringBuilder.reflectionToString(values, - ToStringStyle.SIMPLE_STYLE))); - } - } - } - - return table; - } - - private static List initColumnsForTable() { - List result = new ArrayList(); - - result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("TABLE_TYPE", Types.VARCHAR, "UNKNOWN")); - result.add(new MetaDataColumnDescriptor("TABLE_CAT", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("TABLE_SCHEM", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); - - return result; - } - - private static List initColumnsForColumn() { - List result = new ArrayList(); - - // As suggested by Alexandre Borgoltz, we're reading the COLUMN_DEF first because Oracle - // has problems otherwise (it seemingly requires a LONG column to be the first to be read) - // See also DDLUTILS-29 - result.add(new MetaDataColumnDescriptor("COLUMN_DEF", Types.VARCHAR)); - - // we're also reading the table name so that a model reader impl can filter manually - result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("TYPE_NAME", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("DATA_TYPE", Types.INTEGER, new Integer(java.sql.Types.OTHER))); - result.add(new MetaDataColumnDescriptor("NUM_PREC_RADIX", Types.INTEGER, new Integer(10))); - result.add(new MetaDataColumnDescriptor("DECIMAL_DIGITS", Types.INTEGER, new Integer(0))); - result.add(new MetaDataColumnDescriptor("COLUMN_SIZE", Types.VARCHAR)); - result.add(new MetaDataColumnDescriptor("IS_NULLABLE", Types.VARCHAR, "YES")); - result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); - - return result; - } - - private static List initColumnsForPK() { - List result = new ArrayList(); - - result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); - - // we're also reading the table name so that a model reader impl can filter manually - result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); - - // the name of the primary key is currently only interesting to the pk index name resolution - result.add(new MetaDataColumnDescriptor("PK_NAME", Types.VARCHAR)); - - return result; - } - - private static List readColumns(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException { - ResultSet columnData = null; - - try { - columnData = metaData.getColumns(tableName, null); - - List columns = new ArrayList(); - Map values = null; - - for (; columnData.next(); columns.add(readColumn(metaData, values))) { - Map tmp = readColumns(columnData, initColumnsForColumn()); - if (tableName.equalsIgnoreCase((String) tmp.get("TABLE_NAME"))) { - values = tmp; - } else { - break; - } - } - - // if (true == columns.isEmpty()) { - // Connection con = metaData.getMetaData().getConnection(); - // String propIncludeSynonyms = "includeSynonyms"; - // - // if (PropertyUtils.isWriteable(con, propIncludeSynonyms)) { - // try { - // String includeSynonymsMethodName = "setIncludeSynonyms"; - // boolean previousSynonyms = (Boolean) PropertyUtils.getProperty(con, propIncludeSynonyms); - // - // if (logger.isInfoEnabled()) { - // logger.info("ORACLE: switch includeSynonyms to " + previousSynonyms); - // } - // - // try { - // MethodUtils.invokeMethod(con, includeSynonymsMethodName, !previousSynonyms); - // columns = readColumns(metaData, tableName); - // - // if (false == columns.isEmpty()) { - // return columns; - // } - // } finally { - // MethodUtils.invokeMethod(con, includeSynonymsMethodName, previousSynonyms); - // } - // - // throw new SQLException("ORACLE: no column found for " + tableName); - // } catch (IllegalAccessException e) { - // logger.error(e.getMessage(), e); - // } catch (InvocationTargetException e) { - // logger.error(e.getMessage(), e); - // } catch (NoSuchMethodException e) { - // logger.error(e.getMessage(), e); - // } - // } - // } - - return columns; - } finally { - JdbcUtils.closeResultSet(columnData); - } - } - - private static Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { - Column column = new Column(); - - column.setName((String) values.get("COLUMN_NAME")); - column.setDefaultValue((String) values.get("COLUMN_DEF")); - column.setTypeCode(((Integer) values.get("DATA_TYPE")).intValue()); - - String typeName = (String) values.get("TYPE_NAME"); - - if ((typeName != null) && typeName.startsWith("TIMESTAMP")) { - column.setTypeCode(Types.TIMESTAMP); - } - - Integer precision = (Integer) values.get("NUM_PREC_RADIX"); - - if (precision != null) { - column.setPrecisionRadix(precision.intValue()); - } - - String size = (String) values.get("COLUMN_SIZE"); - - if (size == null) { - size = (String) _defaultSizes.get(new Integer(column.getTypeCode())); - } - - // we're setting the size after the precision and radix in case - // the database prefers to return them in the size value - column.setSize(size); - - int scale = 0; - Object dec_digits = values.get("DECIMAL_DIGITS"); - - if (dec_digits instanceof String) { - scale = (dec_digits == null) ? 0 : NumberUtils.toInt(dec_digits.toString()); - } else if (dec_digits instanceof Integer) { - scale = (dec_digits == null) ? 0 : (Integer) dec_digits; - } - - if (scale != 0) { - column.setScale(scale); - } - - column.setRequired("NO".equalsIgnoreCase(((String) values.get("IS_NULLABLE")).trim())); - column.setDescription((String) values.get("REMARKS")); - - return column; - } - - private static Map readColumns(ResultSet resultSet, List columnDescriptors) - throws SQLException { - Map values = new HashMap(); - MetaDataColumnDescriptor descriptor; - - for (Iterator it = columnDescriptors.iterator(); it.hasNext(); values.put(descriptor.getName(), - descriptor.readColumn(resultSet))) { - descriptor = (MetaDataColumnDescriptor) it.next(); - } - - return values; - } - - private static Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName) - throws SQLException { - ResultSet pkData = null; - - try { - List pks = new ArrayList(); - Map values; - - for (pkData = metaData.getPrimaryKeys(tableName); pkData.next(); pks.add(readPrimaryKeyName(metaData, - values))) { - values = readColumns(pkData, initColumnsForPK()); - } - - return pks; - } finally { - JdbcUtils.closeResultSet(pkData); - } - } - - private static String readPrimaryKeyName(DatabaseMetaDataWrapper metaData, Map values) - throws SQLException { - return (String) values.get("COLUMN_NAME"); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.meta; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Types; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.ddlutils.model.Column; +import org.apache.ddlutils.model.Table; +import org.apache.ddlutils.platform.DatabaseMetaDataWrapper; +import org.apache.ddlutils.platform.MetaDataColumnDescriptor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.ConnectionCallback; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.SingleColumnRowMapper; +import org.springframework.jdbc.support.JdbcUtils; +import org.springframework.util.Assert; + +/** + * copy from otter3.0 + * + * @author xiaoqing.zhouxq 2012-3-30 上午10:43:04 + * @author zebin.xuzb add filter for data + */ +public class DdlUtils { + + private static final Logger logger = LoggerFactory.getLogger(DdlUtils.class); + private static TableType[] SUPPORTED_TABLE_TYPES = new TableType[] { TableType.view, TableType.table }; + private final static Map _defaultSizes = new HashMap(); + + static { + _defaultSizes.put(new Integer(1), "254"); + _defaultSizes.put(new Integer(12), "254"); + _defaultSizes.put(new Integer(-1), "254"); + _defaultSizes.put(new Integer(-2), "254"); + _defaultSizes.put(new Integer(-3), "254"); + _defaultSizes.put(new Integer(-4), "254"); + _defaultSizes.put(new Integer(4), "32"); + _defaultSizes.put(new Integer(-5), "64"); + _defaultSizes.put(new Integer(7), "7,0"); + _defaultSizes.put(new Integer(6), "15,0"); + _defaultSizes.put(new Integer(8), "15,0"); + _defaultSizes.put(new Integer(3), "15,15"); + _defaultSizes.put(new Integer(2), "15,15"); + } + + /** + * !!! Only supports MySQL + */ + @SuppressWarnings("unchecked") + public static List findSchemas(JdbcTemplate jdbcTemplate, final String schemaPattern) { + try { + if (StringUtils.isEmpty(schemaPattern)) { + return jdbcTemplate.query("show databases", new SingleColumnRowMapper(String.class)); + } + return jdbcTemplate.query("show databases like ?", new Object[] { schemaPattern }, + new SingleColumnRowMapper(String.class)); + } catch (Exception e) { + logger.error(e.getMessage(), e); + return new ArrayList(); + } + } + + /** + * !!! Only supports MySQL + */ + public static List findSchemas(JdbcTemplate jdbcTemplate, final String schemaPattern, + final DdlSchemaFilter ddlSchemaFilter) { + List schemas = findSchemas(jdbcTemplate, schemaPattern); + if (ddlSchemaFilter == null) { + return schemas; + } + List filterSchemas = new ArrayList(); + for (String schema : schemas) { + if (ddlSchemaFilter.accept(schema)) { + filterSchemas.add(schema); + } + } + return filterSchemas; + } + + public static Table findTable(JdbcTemplate jdbcTemplate, final String catalogName, final String schemaName, + final String tableName) throws Exception { + return findTable(jdbcTemplate, catalogName, schemaName, tableName, null); + } + + public static Table findTable(final JdbcTemplate jdbcTemplate, final String catalogName, final String schemaName, + final String tableName, final DdlUtilsFilter filter) throws Exception { + return (Table) jdbcTemplate.execute(new ConnectionCallback() { + + public Object doInConnection(Connection con) throws SQLException, DataAccessException { + Table table = null; + DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper(); + + try { + if (filter != null) { + con = filter.filterConnection(con); + Assert.notNull(con); + } + DatabaseMetaData databaseMetaData = con.getMetaData(); + if (filter != null) { + databaseMetaData = filter.filterDataBaseMetaData(jdbcTemplate, con, databaseMetaData); + Assert.notNull(databaseMetaData); + } + + metaData.setMetaData(databaseMetaData); + metaData.setTableTypes(TableType.toStrings(SUPPORTED_TABLE_TYPES)); + String convertTableName = tableName; + if (databaseMetaData.storesUpperCaseIdentifiers()) { + metaData.setCatalog(catalogName.toUpperCase()); + metaData.setSchemaPattern(schemaName.toUpperCase()); + convertTableName = tableName.toUpperCase(); + } + if (databaseMetaData.storesLowerCaseIdentifiers()) { + metaData.setCatalog(catalogName.toLowerCase()); + metaData.setSchemaPattern(schemaName.toLowerCase()); + convertTableName = tableName.toLowerCase(); + } + + ResultSet tableData = null; + try { + tableData = metaData.getTables(convertTableName); + + while ((tableData != null) && tableData.next()) { + Map values = readColumns(tableData, initColumnsForTable()); + + table = readTable(metaData, values); + if (table.getName().equalsIgnoreCase(tableName)) { + break; + } + } + } finally { + JdbcUtils.closeResultSet(tableData); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + + makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(table); + + return table; + } + }); + } + + @SuppressWarnings("unchecked") + public static List
findTables(final JdbcTemplate jdbcTemplate, final String catalogName, + final String schemaName, final String tableNamePattern, + final DdlUtilsFilter filter, final DdlTableNameFilter tableNameFilter) + throws Exception { + return (List
) jdbcTemplate.execute(new ConnectionCallback() { + + public Object doInConnection(Connection con) throws SQLException, DataAccessException { + List
tables = new ArrayList
(); + DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper(); + + try { + if (filter != null) { + con = filter.filterConnection(con); + Assert.notNull(con); + } + DatabaseMetaData databaseMetaData = con.getMetaData(); + if (filter != null) { + databaseMetaData = filter.filterDataBaseMetaData(jdbcTemplate, con, databaseMetaData); + Assert.notNull(databaseMetaData); + } + + metaData.setMetaData(databaseMetaData); + metaData.setTableTypes(TableType.toStrings(SUPPORTED_TABLE_TYPES)); + String convertTableName = tableNamePattern; + if (databaseMetaData.storesUpperCaseIdentifiers()) { + metaData.setCatalog(catalogName.toUpperCase()); + metaData.setSchemaPattern(schemaName.toUpperCase()); + convertTableName = tableNamePattern.toUpperCase(); + } + if (databaseMetaData.storesLowerCaseIdentifiers()) { + metaData.setCatalog(catalogName.toLowerCase()); + metaData.setSchemaPattern(schemaName.toLowerCase()); + convertTableName = tableNamePattern.toLowerCase(); + } + + ResultSet tableData = null; + try { + tableData = metaData.getTables(convertTableName); + + while ((tableData != null) && tableData.next()) { + Map values = readColumns(tableData, initColumnsForTable()); + + Table table = readTable(metaData, values); + if ((tableNameFilter == null) + || tableNameFilter.accept(catalogName, schemaName, table.getName())) { + tables.add(table); + } + } + } finally { + JdbcUtils.closeResultSet(tableData); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + + for (Table table : tables) { + makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(table); + } + + return tables; + } + }); + } + + /** + * Treat tables with no primary keys as a table with all primary keys. + */ + private static void makeAllColumnsPrimaryKeysIfNoPrimaryKeysFound(Table table) { + if ((table != null) && (table.getPrimaryKeyColumns() != null) && (table.getPrimaryKeyColumns().length == 0)) { + Column[] allCoumns = table.getColumns(); + + for (Column column : allCoumns) { + column.setPrimaryKey(true); + } + } + } + + private static Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { + String tableName = (String) values.get("TABLE_NAME"); + Table table = null; + + if ((tableName != null) && (tableName.length() > 0)) { + table = new Table(); + table.setName(tableName); + table.setType((String) values.get("TABLE_TYPE")); + table.setCatalog((String) values.get("TABLE_CAT")); + table.setSchema((String) values.get("TABLE_SCHEM")); + table.setDescription((String) values.get("REMARKS")); + table.addColumns(readColumns(metaData, tableName)); + + Collection primaryKeys = readPrimaryKeyNames(metaData, tableName); + + for (Object key : primaryKeys) { + Column col = table.findColumn((String) key, true); + + if (col != null) { + col.setPrimaryKey(true); + } else { + throw new NullPointerException( + String.format("%s pk %s is null - %s %s", + tableName, + key, + ToStringBuilder.reflectionToString(metaData, + ToStringStyle.SIMPLE_STYLE), + ToStringBuilder.reflectionToString(values, + ToStringStyle.SIMPLE_STYLE))); + } + } + } + + return table; + } + + private static List initColumnsForTable() { + List result = new ArrayList(); + + result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("TABLE_TYPE", Types.VARCHAR, "UNKNOWN")); + result.add(new MetaDataColumnDescriptor("TABLE_CAT", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("TABLE_SCHEM", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); + + return result; + } + + private static List initColumnsForColumn() { + List result = new ArrayList(); + + // As suggested by Alexandre Borgoltz, we're reading the COLUMN_DEF first because Oracle + // has problems otherwise (it seemingly requires a LONG column to be the first to be read) + // See also DDLUTILS-29 + result.add(new MetaDataColumnDescriptor("COLUMN_DEF", Types.VARCHAR)); + + // we're also reading the table name so that a model reader impl can filter manually + result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("TYPE_NAME", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("DATA_TYPE", Types.INTEGER, new Integer(java.sql.Types.OTHER))); + result.add(new MetaDataColumnDescriptor("NUM_PREC_RADIX", Types.INTEGER, new Integer(10))); + result.add(new MetaDataColumnDescriptor("DECIMAL_DIGITS", Types.INTEGER, new Integer(0))); + result.add(new MetaDataColumnDescriptor("COLUMN_SIZE", Types.VARCHAR)); + result.add(new MetaDataColumnDescriptor("IS_NULLABLE", Types.VARCHAR, "YES")); + result.add(new MetaDataColumnDescriptor("REMARKS", Types.VARCHAR)); + + return result; + } + + private static List initColumnsForPK() { + List result = new ArrayList(); + + result.add(new MetaDataColumnDescriptor("COLUMN_NAME", Types.VARCHAR)); + + // we're also reading the table name so that a model reader impl can filter manually + result.add(new MetaDataColumnDescriptor("TABLE_NAME", Types.VARCHAR)); + + // the name of the primary key is currently only interesting to the pk index name resolution + result.add(new MetaDataColumnDescriptor("PK_NAME", Types.VARCHAR)); + + return result; + } + + private static List readColumns(DatabaseMetaDataWrapper metaData, String tableName) throws SQLException { + ResultSet columnData = null; + + try { + columnData = metaData.getColumns(tableName, null); + + List columns = new ArrayList(); + Map values = null; + + for (; columnData.next(); columns.add(readColumn(metaData, values))) { + Map tmp = readColumns(columnData, initColumnsForColumn()); + if (tableName.equalsIgnoreCase((String) tmp.get("TABLE_NAME"))) { + values = tmp; + } else { + break; + } + } + + // if (true == columns.isEmpty()) { + // Connection con = metaData.getMetaData().getConnection(); + // String propIncludeSynonyms = "includeSynonyms"; + // + // if (PropertyUtils.isWriteable(con, propIncludeSynonyms)) { + // try { + // String includeSynonymsMethodName = "setIncludeSynonyms"; + // boolean previousSynonyms = (Boolean) PropertyUtils.getProperty(con, propIncludeSynonyms); + // + // if (logger.isInfoEnabled()) { + // logger.info("ORACLE: switch includeSynonyms to " + previousSynonyms); + // } + // + // try { + // MethodUtils.invokeMethod(con, includeSynonymsMethodName, !previousSynonyms); + // columns = readColumns(metaData, tableName); + // + // if (false == columns.isEmpty()) { + // return columns; + // } + // } finally { + // MethodUtils.invokeMethod(con, includeSynonymsMethodName, previousSynonyms); + // } + // + // throw new SQLException("ORACLE: no column found for " + tableName); + // } catch (IllegalAccessException e) { + // logger.error(e.getMessage(), e); + // } catch (InvocationTargetException e) { + // logger.error(e.getMessage(), e); + // } catch (NoSuchMethodException e) { + // logger.error(e.getMessage(), e); + // } + // } + // } + + return columns; + } finally { + JdbcUtils.closeResultSet(columnData); + } + } + + private static Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException { + Column column = new Column(); + + column.setName((String) values.get("COLUMN_NAME")); + column.setDefaultValue((String) values.get("COLUMN_DEF")); + column.setTypeCode(((Integer) values.get("DATA_TYPE")).intValue()); + + String typeName = (String) values.get("TYPE_NAME"); + + if ((typeName != null) && typeName.startsWith("TIMESTAMP")) { + column.setTypeCode(Types.TIMESTAMP); + } + + Integer precision = (Integer) values.get("NUM_PREC_RADIX"); + + if (precision != null) { + column.setPrecisionRadix(precision.intValue()); + } + + String size = (String) values.get("COLUMN_SIZE"); + + if (size == null) { + size = (String) _defaultSizes.get(new Integer(column.getTypeCode())); + } + + // we're setting the size after the precision and radix in case + // the database prefers to return them in the size value + column.setSize(size); + + int scale = 0; + Object dec_digits = values.get("DECIMAL_DIGITS"); + + if (dec_digits instanceof String) { + scale = (dec_digits == null) ? 0 : NumberUtils.toInt(dec_digits.toString()); + } else if (dec_digits instanceof Integer) { + scale = (dec_digits == null) ? 0 : (Integer) dec_digits; + } + + if (scale != 0) { + column.setScale(scale); + } + + column.setRequired("NO".equalsIgnoreCase(((String) values.get("IS_NULLABLE")).trim())); + column.setDescription((String) values.get("REMARKS")); + + return column; + } + + private static Map readColumns(ResultSet resultSet, List columnDescriptors) + throws SQLException { + Map values = new HashMap(); + MetaDataColumnDescriptor descriptor; + + for (Iterator it = columnDescriptors.iterator(); it.hasNext(); values.put(descriptor.getName(), + descriptor.readColumn(resultSet))) { + descriptor = (MetaDataColumnDescriptor) it.next(); + } + + return values; + } + + private static Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName) + throws SQLException { + ResultSet pkData = null; + + try { + List pks = new ArrayList(); + Map values; + + for (pkData = metaData.getPrimaryKeys(tableName); pkData.next(); pks.add(readPrimaryKeyName(metaData, + values))) { + values = readColumns(pkData, initColumnsForPK()); + } + + return pks; + } finally { + JdbcUtils.closeResultSet(pkData); + } + } + + private static String readPrimaryKeyName(DatabaseMetaDataWrapper metaData, Map values) + throws SQLException { + return (String) values.get("COLUMN_NAME"); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtilsFilter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtilsFilter.java index 02a758e4..cb64d3ad 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtilsFilter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/DdlUtilsFilter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.meta; import java.sql.Connection; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/TableType.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/TableType.java index 8e3bb957..e6aa7fbf 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/TableType.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/meta/TableType.java @@ -1,93 +1,107 @@ -package com.alibaba.otter.shared.common.utils.meta; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -/** - * An enumeration wrapper around JDBC table types. - */ -public enum TableType { - - /** - * Unknown - */ - unknown, - - /** - * System table - */ - system_table, - - /** - * Global temporary - */ - global_temporary, - - /** - * Local temporary - */ - local_temporary, - - /** - * Table - */ - table, - - /** - * View - */ - view, - - /** - * Alias - */ - alias, - - /** - * Synonym - */ - synonym, ; - - /** - * Converts an array of table types to an array of their corresponding string values. - * - * @param tableTypes Array of table types - * @return Array of string table types - */ - public static String[] toStrings(final TableType[] tableTypes) { - if ((tableTypes == null) || (tableTypes.length == 0)) { - return new String[0]; - } - - final List tableTypeStrings = new ArrayList(tableTypes.length); - - for (final TableType tableType : tableTypes) { - if (tableType != null) { - tableTypeStrings.add(tableType.toString().toUpperCase(Locale.ENGLISH)); - } - } - - return tableTypeStrings.toArray(new String[tableTypeStrings.size()]); - } - - /** - * Converts an array of string table types to an array of their corresponding enumeration values. - * - * @param tableTypeStrings Array of string table types - * @return Array of table types - */ - public static TableType[] valueOf(final String[] tableTypeStrings) { - if ((tableTypeStrings == null) || (tableTypeStrings.length == 0)) { - return new TableType[0]; - } - - final List tableTypes = new ArrayList(tableTypeStrings.length); - - for (final String tableTypeString : tableTypeStrings) { - tableTypes.add(valueOf(tableTypeString.toLowerCase(Locale.ENGLISH))); - } - - return tableTypes.toArray(new TableType[tableTypes.size()]); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.meta; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +/** + * An enumeration wrapper around JDBC table types. + */ +public enum TableType { + + /** + * Unknown + */ + unknown, + + /** + * System table + */ + system_table, + + /** + * Global temporary + */ + global_temporary, + + /** + * Local temporary + */ + local_temporary, + + /** + * Table + */ + table, + + /** + * View + */ + view, + + /** + * Alias + */ + alias, + + /** + * Synonym + */ + synonym, ; + + /** + * Converts an array of table types to an array of their corresponding string values. + * + * @param tableTypes Array of table types + * @return Array of string table types + */ + public static String[] toStrings(final TableType[] tableTypes) { + if ((tableTypes == null) || (tableTypes.length == 0)) { + return new String[0]; + } + + final List tableTypeStrings = new ArrayList(tableTypes.length); + + for (final TableType tableType : tableTypes) { + if (tableType != null) { + tableTypeStrings.add(tableType.toString().toUpperCase(Locale.ENGLISH)); + } + } + + return tableTypeStrings.toArray(new String[tableTypeStrings.size()]); + } + + /** + * Converts an array of string table types to an array of their corresponding enumeration values. + * + * @param tableTypeStrings Array of string table types + * @return Array of table types + */ + public static TableType[] valueOf(final String[] tableTypeStrings) { + if ((tableTypeStrings == null) || (tableTypeStrings.length == 0)) { + return new TableType[0]; + } + + final List tableTypes = new ArrayList(tableTypeStrings.length); + + for (final String tableTypeString : tableTypeStrings) { + tableTypes.add(valueOf(tableTypeString.toLowerCase(Locale.ENGLISH))); + } + + return tableTypes.toArray(new TableType[tableTypes.size()]); + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/NaiveSizeOf.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/NaiveSizeOf.java index 8a35e979..f14af32a 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/NaiveSizeOf.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/NaiveSizeOf.java @@ -1,121 +1,135 @@ -package com.alibaba.otter.shared.common.utils.sizeof; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -/* http://www.glenmccl.com/tip_038.htm modified 1999-10 */ -/** - * Sizeof For Java(tm) Java(tm) has no sizeof() operator like C/C++.With uniform sizes for primitive data types, and a - * different style of memory allocation, the need for sizeof() really isn't there. And it's hard to define what sizeof() - * would mean anyway, given that an object may not contain other objects, but only references to them. But it's - * interesting to experiment with the 1.1 reflection feature and see whether a method can be devised that will return - * useful information about object sizes. The Sizeof class below tries to do this, for a passed-in data structure. It - * walks the structure and tallies up the total size in bytes. It ignores alignment and packing issues and hidden fields - * in structures, and assumes a boolean is of size 1 and a reference of size 4 (reference sizes may vary; for example - * SZ_REF might be 8 on a machine with 64-bit pointers). It does not count static data members of class instances, but - * does include members inherited/implemented from superclasses and interfaces. It does not follow references in object - * instances or in arrays, except for the case of a multi-dimensional array, where the reference is to another array. - */ -public class NaiveSizeOf { - - private NaiveSizeOf(){ - super(); - } - - private static final int SZ_REF = 4; - - public static int sizeof(boolean b) { - return 1; - } - - public static int sizeof(byte b) { - return 1; - } - - public static int sizeof(char c) { - return 2; - } - - public static int sizeof(short s) { - return 2; - } - - public static int sizeof(int i) { - return 4; - } - - public static int sizeof(long l) { - return 8; - } - - public static int sizeof(float f) { - return 4; - } - - public static int sizeof(double d) { - return 8; - } - - private static int size_inst(final Class c) { - Field flds[] = c.getDeclaredFields(); - int sz = 0; - - for (int i = 0; i < flds.length; ++i) { - Field f = flds[i]; - if (!c.isInterface() && (f.getModifiers() & Modifier.STATIC) != 0) continue; - sz += size_prim(f.getType()); - } - - if (c.getSuperclass() != null) sz += size_inst(c.getSuperclass()); - - Class cv[] = c.getInterfaces(); - for (int i = 0; i < cv.length; ++i) - sz += size_inst(cv[i]); - - return sz; - } - - private static int size_prim(final Class t) { - if (t == Boolean.TYPE) return 1; - else if (t == Byte.TYPE) return 1; - else if (t == Character.TYPE) return 2; - else if (t == Short.TYPE) return 2; - else if (t == Integer.TYPE) return 4; - else if (t == Long.TYPE) return 8; - else if (t == Float.TYPE) return 4; - else if (t == Double.TYPE) return 8; - else if (t == Void.TYPE) return 0; - else return SZ_REF; - } - - private static int size_arr(final Object obj, final Class c) { - Class ct = c.getComponentType(); - int len = Array.getLength(obj); - - if (ct.isPrimitive()) { - return len * size_prim(ct); - } else { - int sz = 0; - for (int i = 0; i < len; ++i) { - sz += SZ_REF; - Object obj2 = Array.get(obj, i); - if (obj2 == null) continue; - Class c2 = obj2.getClass(); - if (!c2.isArray()) continue; - sz += size_arr(obj2, c2); - } - return sz; - } - } - - public static int sizeof(final Object obj) { - if (null == obj) return 0; - - Class c = obj.getClass(); - - if (c.isArray()) return size_arr(obj, c); - else return size_inst(c); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.sizeof; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +/* http://www.glenmccl.com/tip_038.htm modified 1999-10 */ +/** + * Sizeof For Java(tm) Java(tm) has no sizeof() operator like C/C++.With uniform sizes for primitive data types, and a + * different style of memory allocation, the need for sizeof() really isn't there. And it's hard to define what sizeof() + * would mean anyway, given that an object may not contain other objects, but only references to them. But it's + * interesting to experiment with the 1.1 reflection feature and see whether a method can be devised that will return + * useful information about object sizes. The Sizeof class below tries to do this, for a passed-in data structure. It + * walks the structure and tallies up the total size in bytes. It ignores alignment and packing issues and hidden fields + * in structures, and assumes a boolean is of size 1 and a reference of size 4 (reference sizes may vary; for example + * SZ_REF might be 8 on a machine with 64-bit pointers). It does not count static data members of class instances, but + * does include members inherited/implemented from superclasses and interfaces. It does not follow references in object + * instances or in arrays, except for the case of a multi-dimensional array, where the reference is to another array. + */ +public class NaiveSizeOf { + + private NaiveSizeOf(){ + super(); + } + + private static final int SZ_REF = 4; + + public static int sizeof(boolean b) { + return 1; + } + + public static int sizeof(byte b) { + return 1; + } + + public static int sizeof(char c) { + return 2; + } + + public static int sizeof(short s) { + return 2; + } + + public static int sizeof(int i) { + return 4; + } + + public static int sizeof(long l) { + return 8; + } + + public static int sizeof(float f) { + return 4; + } + + public static int sizeof(double d) { + return 8; + } + + private static int size_inst(final Class c) { + Field flds[] = c.getDeclaredFields(); + int sz = 0; + + for (int i = 0; i < flds.length; ++i) { + Field f = flds[i]; + if (!c.isInterface() && (f.getModifiers() & Modifier.STATIC) != 0) continue; + sz += size_prim(f.getType()); + } + + if (c.getSuperclass() != null) sz += size_inst(c.getSuperclass()); + + Class cv[] = c.getInterfaces(); + for (int i = 0; i < cv.length; ++i) + sz += size_inst(cv[i]); + + return sz; + } + + private static int size_prim(final Class t) { + if (t == Boolean.TYPE) return 1; + else if (t == Byte.TYPE) return 1; + else if (t == Character.TYPE) return 2; + else if (t == Short.TYPE) return 2; + else if (t == Integer.TYPE) return 4; + else if (t == Long.TYPE) return 8; + else if (t == Float.TYPE) return 4; + else if (t == Double.TYPE) return 8; + else if (t == Void.TYPE) return 0; + else return SZ_REF; + } + + private static int size_arr(final Object obj, final Class c) { + Class ct = c.getComponentType(); + int len = Array.getLength(obj); + + if (ct.isPrimitive()) { + return len * size_prim(ct); + } else { + int sz = 0; + for (int i = 0; i < len; ++i) { + sz += SZ_REF; + Object obj2 = Array.get(obj, i); + if (obj2 == null) continue; + Class c2 = obj2.getClass(); + if (!c2.isArray()) continue; + sz += size_arr(obj2, c2); + } + return sz; + } + } + + public static int sizeof(final Object obj) { + if (null == obj) return 0; + + Class c = obj.getClass(); + + if (c.isArray()) return size_arr(obj, c); + else return size_inst(c); + } + +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java index 6d46ead2..0e7db9b7 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/sizeof/ObjectProfiler.java @@ -1,524 +1,538 @@ -package com.alibaba.otter.shared.common.utils.sizeof; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.math.BigInteger; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.jar.JarFile; - -// ---------------------------------------------------------------------------- -/** - * This non-instantiable class presents an API for object sizing as described in the article. See individual methods for - * details. - *

- * This implementation is J2SE 1.4+ only. You would need to code your own identity hashmap to port this to earlier Java - * versions. - *

- * Security: this implementation uses AccessController.doPrivileged() so it could be granted privileges to access - * non-public class fields separately from your main application code. The minimum set of permissions necessary for this - * class to function correctly follows: - * - *

- *    permission java.lang.RuntimePermission "accessDeclaredMembers";
- *    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- * 
- * - * @author (C) Vlad Roubtsov, 2003 - */ -public abstract class ObjectProfiler { - - // public: ................................................................ - - // the following constants are physical sizes (in bytes) and are JVM-dependent: - // [the current values are Ok for most 32-bit JVMs] - - public static final int OBJECT_SHELL_SIZE = 8; // java.lang.Object shell - // size in bytes - public static final int OBJREF_SIZE = 4; - public static final int LONG_FIELD_SIZE = 8; - public static final int INT_FIELD_SIZE = 4; - public static final int SHORT_FIELD_SIZE = 2; - public static final int CHAR_FIELD_SIZE = 2; - public static final int BYTE_FIELD_SIZE = 1; - public static final int BOOLEAN_FIELD_SIZE = 1; - public static final int DOUBLE_FIELD_SIZE = 8; - public static final int FLOAT_FIELD_SIZE = 4; - - /** - * Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted - * for. The implementation is not recursive. - * - * @param obj input object instance to be measured - * @return 'obj' size [0 if 'obj' is null'] - */ - public static long sizeof(final Object obj) { - if (null == obj || isSharedFlyweight(obj)) { - return 0; - } - - final IdentityHashMap visited = new IdentityHashMap(80000); - - try { - return computeSizeof(obj, visited, CLASS_METADATA_CACHE); - } catch (RuntimeException re) { - // re.printStackTrace();//DEBUG - return -1; - } catch (NoClassDefFoundError ncdfe) { - // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD - // 5 - // see - // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= - // System.err.println(ncdfe);//DEBUG - return -1; - } - } - - /** - * Estimates the full size of the object graph rooted at 'obj' by pre-populating the "visited" set with the object - * graph rooted at 'base'. The net effect is to compute the size of 'obj' by summing over all instance data - * contained in 'obj' but not in 'base'. - * - * @param base graph boundary [may not be null] - * @param obj input object instance to be measured - * @return 'obj' size [0 if 'obj' is null'] - */ - public static long sizedelta(final Object base, final Object obj) { - if (null == obj || isSharedFlyweight(obj)) { - return 0; - } - if (null == base) { - throw new IllegalArgumentException("null input: base"); - } - - final IdentityHashMap visited = new IdentityHashMap(40000); - - try { - computeSizeof(base, visited, CLASS_METADATA_CACHE); - return visited.containsKey(obj) ? 0 : computeSizeof(obj, visited, CLASS_METADATA_CACHE); - } catch (RuntimeException re) { - // re.printStackTrace();//DEBUG - return -1; - } catch (NoClassDefFoundError ncdfe) { - // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD - // 5 - // see - // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= - // System.err.println(ncdfe);//DEBUG - return -1; - } - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - /* - * Internal class used to cache class metadata information. - */ - private static final class ClassMetadata { - - ClassMetadata(final int primitiveFieldCount, final int shellSize, final Field[] refFields){ - m_primitiveFieldCount = primitiveFieldCount; - m_shellSize = shellSize; - m_refFields = refFields; - } - - // all fields are inclusive of superclasses: - - final int m_primitiveFieldCount; - - final int m_shellSize; // class shell size - - final Field[] m_refFields; // cached non-static fields (made accessible) - - } // end of nested class - - private static final class ClassAccessPrivilegedAction implements PrivilegedExceptionAction { - - /** {@inheritDoc} */ - public Object run() throws Exception { - return m_cls.getDeclaredFields(); - } - - void setContext(final Class cls) { - m_cls = cls; - } - - private Class m_cls; - - } // end of nested class - - private static final class FieldAccessPrivilegedAction implements PrivilegedExceptionAction { - - /** {@inheritDoc} */ - public Object run() throws Exception { - m_field.setAccessible(true); - return null; - } - - void setContext(final Field field) { - m_field = field; - } - - private Field m_field; - - } // end of nested class - - private ObjectProfiler(){ - } // this class is not extendible - - /* - * The main worker method for sizeof() and sizedelta(). - */ - private static long computeSizeof(Object obj, final IdentityHashMap visited, - final Map /* */metadataMap) { - // this uses depth-first traversal; the exact graph traversal algorithm - // does not matter for computing the total size and this method could be - // easily adjusted to do breadth-first instead (addLast() instead of - // addFirst()), - // however, dfs/bfs require max queue length to be the length of the - // longest - // graph path/width of traversal front correspondingly, so I expect - // dfs to use fewer resources than bfs for most Java objects; - - if (null == obj || isSharedFlyweight(obj)) { - return 0; - } - - final LinkedList queue = new LinkedList(); - - visited.put(obj, obj); - queue.add(obj); - - long result = 0; - - final ClassAccessPrivilegedAction caAction = new ClassAccessPrivilegedAction(); - final FieldAccessPrivilegedAction faAction = new FieldAccessPrivilegedAction(); - - while (!queue.isEmpty()) { - obj = queue.removeFirst(); - final Class objClass = obj.getClass(); - - int skippedBytes = skipClassDueToSunJVMBug(objClass); - if (skippedBytes > 0) { - result += skippedBytes; // can't do better than that - continue; - } - - if (objClass.isArray()) { - final int arrayLength = Array.getLength(obj); - final Class componentType = objClass.getComponentType(); - - result += sizeofArrayShell(arrayLength, componentType); - - if (!componentType.isPrimitive()) { - // traverse each array slot: - for (int i = 0; i < arrayLength; ++i) { - final Object ref = Array.get(obj, i); - - if ((ref != null) && !visited.containsKey(ref)) { - visited.put(ref, ref); - queue.addFirst(ref); - } - } - } - } else { // the object is of a non-array type - final ClassMetadata metadata = getClassMetadata(objClass, metadataMap, caAction, faAction); - final Field[] fields = metadata.m_refFields; - - result += metadata.m_shellSize; - - // traverse all non-null ref fields: - for (int f = 0, fLimit = fields.length; f < fLimit; ++f) { - final Field field = fields[f]; - - final Object ref; - try { // to get the field value: - ref = field.get(obj); - } catch (Exception e) { - throw new RuntimeException("cannot get field [" + field.getName() + "] of class [" - + field.getDeclaringClass().getName() + "]: " + e.toString()); - } - - if ((ref != null) && !visited.containsKey(ref)) { - visited.put(ref, ref); - queue.addFirst(ref); - } - } - } - } - - return result; - } - - /* - * A helper method for manipulating a class metadata cache. - */ - private static ClassMetadata getClassMetadata(final Class cls, final Map /* */metadataMap, - final ClassAccessPrivilegedAction caAction, - final FieldAccessPrivilegedAction faAction) { - if (null == cls) { - return null; - } - - ClassMetadata result; - synchronized (metadataMap) { - result = (ClassMetadata) metadataMap.get(cls); - } - if (result != null) { - return result; - } - - int primitiveFieldCount = 0; - int shellSize = OBJECT_SHELL_SIZE; // java.lang.Object shell - final List /* Field */refFields = new LinkedList(); - - final Field[] declaredFields; - try { - caAction.setContext(cls); - declaredFields = (Field[]) AccessController.doPrivileged(caAction); - } catch (PrivilegedActionException pae) { - throw new RuntimeException("could not access declared fields of class " + cls.getName() + ": " - + pae.getException()); - } - - for (int f = 0; f < declaredFields.length; ++f) { - final Field field = declaredFields[f]; - if (Modifier.isStatic(field.getModifiers())) { - continue; - } - /* - * Can't do that: HashMap data is transient, for example... if (Modifier.isTransient(field.getModifiers())) - * { shellSize += OBJREF_SIZE; continue; } - */ - - final Class fieldType = field.getType(); - if (fieldType.isPrimitive()) { - // memory alignment ignored: - shellSize += sizeofPrimitiveType(fieldType); - ++primitiveFieldCount; - } else { - // prepare for graph traversal later: - if (!field.isAccessible()) { - try { - faAction.setContext(field); - AccessController.doPrivileged(faAction); - } catch (PrivilegedActionException pae) { - throw new RuntimeException("could not make field " + field + " accessible: " - + pae.getException()); - } - } - - // memory alignment ignored: - shellSize += OBJREF_SIZE; - refFields.add(field); - } - } - - // recurse into superclass: - final ClassMetadata superMetadata = getClassMetadata(cls.getSuperclass(), metadataMap, caAction, faAction); - if (superMetadata != null) { - primitiveFieldCount += superMetadata.m_primitiveFieldCount; - shellSize += superMetadata.m_shellSize - OBJECT_SHELL_SIZE; - refFields.addAll(Arrays.asList(superMetadata.m_refFields)); - } - - final Field[] _refFields = new Field[refFields.size()]; - refFields.toArray(_refFields); - - result = new ClassMetadata(primitiveFieldCount, shellSize, _refFields); - synchronized (metadataMap) { - metadataMap.put(cls, result); - } - - return result; - } - - /* - * Computes the "shallow" size of an array instance. - */ - private static int sizeofArrayShell(final int length, final Class componentType) { - // this ignores memory alignment issues by design: - - final int slotSize = componentType.isPrimitive() ? sizeofPrimitiveType(componentType) : OBJREF_SIZE; - - return OBJECT_SHELL_SIZE + INT_FIELD_SIZE + OBJREF_SIZE + length * slotSize; - } - - /* - * Returns the JVM-specific size of a primitive type. - */ - private static int sizeofPrimitiveType(final Class type) { - if (type == int.class) { - return INT_FIELD_SIZE; - } else if (type == long.class) { - return LONG_FIELD_SIZE; - } else if (type == short.class) { - return SHORT_FIELD_SIZE; - } else if (type == byte.class) { - return BYTE_FIELD_SIZE; - } else if (type == boolean.class) { - return BOOLEAN_FIELD_SIZE; - } else if (type == char.class) { - return CHAR_FIELD_SIZE; - } else if (type == double.class) { - return DOUBLE_FIELD_SIZE; - } else if (type == float.class) { - return FLOAT_FIELD_SIZE; - } else { - throw new IllegalArgumentException("not primitive: " + type); - } - } - - // class metadata cache: - private static final Map CLASS_METADATA_CACHE = new WeakHashMap(101); - - static final Class[] sunProblematicClasses; - static final Map /* */sunProblematicClassesSizes; - - static { - Map classesSizes = new HashMap(); - classesSizes.put("java.lang.Class", Integers.valueOf(OBJECT_SHELL_SIZE));// not really a pb, but since this is - // shared, so there's no point in going - // further - // 1.3+ - classesSizes.put("java.lang.Throwable", Integers.valueOf(OBJECT_SHELL_SIZE + 4 * OBJREF_SIZE)); - // 1.4+ - classesSizes.put("sun.reflect.UnsafeStaticFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticBooleanFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticByteFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticShortFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticIntegerFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticLongFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticCharacterFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticFloatFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticDoubleFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - classesSizes.put("sun.reflect.UnsafeStaticObjectFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown - // 1.5+ - classesSizes.put("java.lang.Enum", Integers.valueOf(OBJECT_SHELL_SIZE));// not really a pb, but since this is - // shared, so there's no point in going - // further - classesSizes.put("sun.reflect.ConstantPool", Integers.valueOf(OBJECT_SHELL_SIZE + OBJECT_SHELL_SIZE)); - sunProblematicClassesSizes = Collections.unmodifiableMap(classesSizes); - - List classes = new ArrayList(sunProblematicClassesSizes.size()); - Iterator iter = sunProblematicClassesSizes.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - String className = (String) entry.getKey(); - try { - classes.add(Class.forName(className)); - } catch (ClassNotFoundException cnfe) { - // } catch (ExceptionInInitializerError eiie) { - // } catch (NoClassDefFoundError ncdfe) { - // } catch (UnsatisfiedLinkError le) { - } catch (LinkageError le) { - // BEA JRockit 1.4 also throws NoClassDefFoundError and UnsatisfiedLinkError - } - } - sunProblematicClasses = (Class[]) classes.toArray(new Class[0]); - } - - /** - * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5012949 Implementation note: we can compare classes with == - * since they will always be loaded from the same ClassLoader (they are "low" in the hierarchy) - */ - private static int skipClassDueToSunJVMBug(Class clazz) { - for (int i = 0; i < sunProblematicClasses.length; ++i) { - Class sunPbClass = sunProblematicClasses[i]; - if (clazz == sunPbClass) { - return ((Integer) sunProblematicClassesSizes.get(clazz.getName())).intValue(); - } - } - return 0; - } - - /* - * Very very incomplete, but better than nothing... - */ - // See http://download.oracle.com/javase/7/docs/api/constant-values.html for JDK's String constants - private static boolean isSharedFlyweight(Object obj) { - if (obj == null) { - return true; - } - if (obj == Boolean.TRUE || obj == Boolean.FALSE) { - return true; - } - if (/* obj == Locale.ROOT || *//* Java 6 */ - obj == Locale.ENGLISH || obj == Locale.FRENCH || obj == Locale.GERMAN || obj == Locale.ITALIAN - || obj == Locale.JAPANESE || obj == Locale.KOREAN || obj == Locale.CHINESE - || obj == Locale.SIMPLIFIED_CHINESE || obj == Locale.TRADITIONAL_CHINESE || obj == Locale.FRANCE - || obj == Locale.GERMANY || obj == Locale.ITALY || obj == Locale.JAPAN || obj == Locale.KOREA - || obj == Locale.CHINA || obj == Locale.PRC || obj == Locale.TAIWAN || obj == Locale.UK - || obj == Locale.US || obj == Locale.CANADA || obj == Locale.CANADA_FRENCH) { - return true; - } - if (obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP) { - return true; - } - if (obj == BigInteger.ZERO || obj == BigInteger.ONE) { - return true; - } - if (obj == System.in || obj == System.out || obj == System.err) { - return true; - } - if (obj == String.CASE_INSENSITIVE_ORDER) { - return true; - } - if (obj == JarFile.MANIFEST_NAME) { - return true; - } - return false; - } -} - -final class Integers { - - private Integers(){ - } - - private static final int cache_low = -128; - private static final int cache_high = 127; - private static final Integer cache[] = new Integer[(cache_high - cache_low) + 1]; - - static { - for (int i = 0; i < cache.length; ++i) { - cache[i] = new Integer(i + cache_low); - } - } - - /** - * Returns a Integer instance representing the specified int value. If a new Integer - * instance is not required, this method should generally be used in preference to the constructor - * {@link #Integer(int)}, as this method is likely to yield significantly better space and time performance by - * caching frequently requested values. - * - * @param i an int value. - * @return a Integer instance representing i. - * @since 1.5 - */ - public static Integer valueOf(int i) { - if (i >= cache_low && i <= cache_high) { // must cache - return cache[i - cache_low]; - } else { - return new Integer(i); - } - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.sizeof; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.math.BigInteger; +import java.security.AccessController; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.WeakHashMap; +import java.util.jar.JarFile; + +// ---------------------------------------------------------------------------- +/** + * This non-instantiable class presents an API for object sizing as described in the article. See individual methods for + * details. + *

+ * This implementation is J2SE 1.4+ only. You would need to code your own identity hashmap to port this to earlier Java + * versions. + *

+ * Security: this implementation uses AccessController.doPrivileged() so it could be granted privileges to access + * non-public class fields separately from your main application code. The minimum set of permissions necessary for this + * class to function correctly follows: + * + *

+ *    permission java.lang.RuntimePermission "accessDeclaredMembers";
+ *    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+ * 
+ * + * @author (C) Vlad Roubtsov, 2003 + */ +public abstract class ObjectProfiler { + + // public: ................................................................ + + // the following constants are physical sizes (in bytes) and are JVM-dependent: + // [the current values are Ok for most 32-bit JVMs] + + public static final int OBJECT_SHELL_SIZE = 8; // java.lang.Object shell + // size in bytes + public static final int OBJREF_SIZE = 4; + public static final int LONG_FIELD_SIZE = 8; + public static final int INT_FIELD_SIZE = 4; + public static final int SHORT_FIELD_SIZE = 2; + public static final int CHAR_FIELD_SIZE = 2; + public static final int BYTE_FIELD_SIZE = 1; + public static final int BOOLEAN_FIELD_SIZE = 1; + public static final int DOUBLE_FIELD_SIZE = 8; + public static final int FLOAT_FIELD_SIZE = 4; + + /** + * Estimates the full size of the object graph rooted at 'obj'. Duplicate data instances are correctly accounted + * for. The implementation is not recursive. + * + * @param obj input object instance to be measured + * @return 'obj' size [0 if 'obj' is null'] + */ + public static long sizeof(final Object obj) { + if (null == obj || isSharedFlyweight(obj)) { + return 0; + } + + final IdentityHashMap visited = new IdentityHashMap(80000); + + try { + return computeSizeof(obj, visited, CLASS_METADATA_CACHE); + } catch (RuntimeException re) { + // re.printStackTrace();//DEBUG + return -1; + } catch (NoClassDefFoundError ncdfe) { + // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD + // 5 + // see + // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= + // System.err.println(ncdfe);//DEBUG + return -1; + } + } + + /** + * Estimates the full size of the object graph rooted at 'obj' by pre-populating the "visited" set with the object + * graph rooted at 'base'. The net effect is to compute the size of 'obj' by summing over all instance data + * contained in 'obj' but not in 'base'. + * + * @param base graph boundary [may not be null] + * @param obj input object instance to be measured + * @return 'obj' size [0 if 'obj' is null'] + */ + public static long sizedelta(final Object base, final Object obj) { + if (null == obj || isSharedFlyweight(obj)) { + return 0; + } + if (null == base) { + throw new IllegalArgumentException("null input: base"); + } + + final IdentityHashMap visited = new IdentityHashMap(40000); + + try { + computeSizeof(base, visited, CLASS_METADATA_CACHE); + return visited.containsKey(obj) ? 0 : computeSizeof(obj, visited, CLASS_METADATA_CACHE); + } catch (RuntimeException re) { + // re.printStackTrace();//DEBUG + return -1; + } catch (NoClassDefFoundError ncdfe) { + // BUG: throws "java.lang.NoClassDefFoundError: org.eclipse.core.resources.IWorkspaceRoot" when run in WSAD + // 5 + // see + // http://www.javaworld.com/javaforums/showflat.php?Cat=&Board=958763&Number=15235&page=0&view=collapsed&sb=5&o= + // System.err.println(ncdfe);//DEBUG + return -1; + } + } + + // protected: ............................................................. + + // package: ............................................................... + + // private: ............................................................... + + /* + * Internal class used to cache class metadata information. + */ + private static final class ClassMetadata { + + ClassMetadata(final int primitiveFieldCount, final int shellSize, final Field[] refFields){ + m_primitiveFieldCount = primitiveFieldCount; + m_shellSize = shellSize; + m_refFields = refFields; + } + + // all fields are inclusive of superclasses: + + final int m_primitiveFieldCount; + + final int m_shellSize; // class shell size + + final Field[] m_refFields; // cached non-static fields (made accessible) + + } // end of nested class + + private static final class ClassAccessPrivilegedAction implements PrivilegedExceptionAction { + + /** {@inheritDoc} */ + public Object run() throws Exception { + return m_cls.getDeclaredFields(); + } + + void setContext(final Class cls) { + m_cls = cls; + } + + private Class m_cls; + + } // end of nested class + + private static final class FieldAccessPrivilegedAction implements PrivilegedExceptionAction { + + /** {@inheritDoc} */ + public Object run() throws Exception { + m_field.setAccessible(true); + return null; + } + + void setContext(final Field field) { + m_field = field; + } + + private Field m_field; + + } // end of nested class + + private ObjectProfiler(){ + } // this class is not extendible + + /* + * The main worker method for sizeof() and sizedelta(). + */ + private static long computeSizeof(Object obj, final IdentityHashMap visited, + final Map /* */metadataMap) { + // this uses depth-first traversal; the exact graph traversal algorithm + // does not matter for computing the total size and this method could be + // easily adjusted to do breadth-first instead (addLast() instead of + // addFirst()), + // however, dfs/bfs require max queue length to be the length of the + // longest + // graph path/width of traversal front correspondingly, so I expect + // dfs to use fewer resources than bfs for most Java objects; + + if (null == obj || isSharedFlyweight(obj)) { + return 0; + } + + final LinkedList queue = new LinkedList(); + + visited.put(obj, obj); + queue.add(obj); + + long result = 0; + + final ClassAccessPrivilegedAction caAction = new ClassAccessPrivilegedAction(); + final FieldAccessPrivilegedAction faAction = new FieldAccessPrivilegedAction(); + + while (!queue.isEmpty()) { + obj = queue.removeFirst(); + final Class objClass = obj.getClass(); + + int skippedBytes = skipClassDueToSunJVMBug(objClass); + if (skippedBytes > 0) { + result += skippedBytes; // can't do better than that + continue; + } + + if (objClass.isArray()) { + final int arrayLength = Array.getLength(obj); + final Class componentType = objClass.getComponentType(); + + result += sizeofArrayShell(arrayLength, componentType); + + if (!componentType.isPrimitive()) { + // traverse each array slot: + for (int i = 0; i < arrayLength; ++i) { + final Object ref = Array.get(obj, i); + + if ((ref != null) && !visited.containsKey(ref)) { + visited.put(ref, ref); + queue.addFirst(ref); + } + } + } + } else { // the object is of a non-array type + final ClassMetadata metadata = getClassMetadata(objClass, metadataMap, caAction, faAction); + final Field[] fields = metadata.m_refFields; + + result += metadata.m_shellSize; + + // traverse all non-null ref fields: + for (int f = 0, fLimit = fields.length; f < fLimit; ++f) { + final Field field = fields[f]; + + final Object ref; + try { // to get the field value: + ref = field.get(obj); + } catch (Exception e) { + throw new RuntimeException("cannot get field [" + field.getName() + "] of class [" + + field.getDeclaringClass().getName() + "]: " + e.toString()); + } + + if ((ref != null) && !visited.containsKey(ref)) { + visited.put(ref, ref); + queue.addFirst(ref); + } + } + } + } + + return result; + } + + /* + * A helper method for manipulating a class metadata cache. + */ + private static ClassMetadata getClassMetadata(final Class cls, final Map /* */metadataMap, + final ClassAccessPrivilegedAction caAction, + final FieldAccessPrivilegedAction faAction) { + if (null == cls) { + return null; + } + + ClassMetadata result; + synchronized (metadataMap) { + result = (ClassMetadata) metadataMap.get(cls); + } + if (result != null) { + return result; + } + + int primitiveFieldCount = 0; + int shellSize = OBJECT_SHELL_SIZE; // java.lang.Object shell + final List /* Field */refFields = new LinkedList(); + + final Field[] declaredFields; + try { + caAction.setContext(cls); + declaredFields = (Field[]) AccessController.doPrivileged(caAction); + } catch (PrivilegedActionException pae) { + throw new RuntimeException("could not access declared fields of class " + cls.getName() + ": " + + pae.getException()); + } + + for (int f = 0; f < declaredFields.length; ++f) { + final Field field = declaredFields[f]; + if (Modifier.isStatic(field.getModifiers())) { + continue; + } + /* + * Can't do that: HashMap data is transient, for example... if (Modifier.isTransient(field.getModifiers())) + * { shellSize += OBJREF_SIZE; continue; } + */ + + final Class fieldType = field.getType(); + if (fieldType.isPrimitive()) { + // memory alignment ignored: + shellSize += sizeofPrimitiveType(fieldType); + ++primitiveFieldCount; + } else { + // prepare for graph traversal later: + if (!field.isAccessible()) { + try { + faAction.setContext(field); + AccessController.doPrivileged(faAction); + } catch (PrivilegedActionException pae) { + throw new RuntimeException("could not make field " + field + " accessible: " + + pae.getException()); + } + } + + // memory alignment ignored: + shellSize += OBJREF_SIZE; + refFields.add(field); + } + } + + // recurse into superclass: + final ClassMetadata superMetadata = getClassMetadata(cls.getSuperclass(), metadataMap, caAction, faAction); + if (superMetadata != null) { + primitiveFieldCount += superMetadata.m_primitiveFieldCount; + shellSize += superMetadata.m_shellSize - OBJECT_SHELL_SIZE; + refFields.addAll(Arrays.asList(superMetadata.m_refFields)); + } + + final Field[] _refFields = new Field[refFields.size()]; + refFields.toArray(_refFields); + + result = new ClassMetadata(primitiveFieldCount, shellSize, _refFields); + synchronized (metadataMap) { + metadataMap.put(cls, result); + } + + return result; + } + + /* + * Computes the "shallow" size of an array instance. + */ + private static int sizeofArrayShell(final int length, final Class componentType) { + // this ignores memory alignment issues by design: + + final int slotSize = componentType.isPrimitive() ? sizeofPrimitiveType(componentType) : OBJREF_SIZE; + + return OBJECT_SHELL_SIZE + INT_FIELD_SIZE + OBJREF_SIZE + length * slotSize; + } + + /* + * Returns the JVM-specific size of a primitive type. + */ + private static int sizeofPrimitiveType(final Class type) { + if (type == int.class) { + return INT_FIELD_SIZE; + } else if (type == long.class) { + return LONG_FIELD_SIZE; + } else if (type == short.class) { + return SHORT_FIELD_SIZE; + } else if (type == byte.class) { + return BYTE_FIELD_SIZE; + } else if (type == boolean.class) { + return BOOLEAN_FIELD_SIZE; + } else if (type == char.class) { + return CHAR_FIELD_SIZE; + } else if (type == double.class) { + return DOUBLE_FIELD_SIZE; + } else if (type == float.class) { + return FLOAT_FIELD_SIZE; + } else { + throw new IllegalArgumentException("not primitive: " + type); + } + } + + // class metadata cache: + private static final Map CLASS_METADATA_CACHE = new WeakHashMap(101); + + static final Class[] sunProblematicClasses; + static final Map /* */sunProblematicClassesSizes; + + static { + Map classesSizes = new HashMap(); + classesSizes.put("java.lang.Class", Integers.valueOf(OBJECT_SHELL_SIZE));// not really a pb, but since this is + // shared, so there's no point in going + // further + // 1.3+ + classesSizes.put("java.lang.Throwable", Integers.valueOf(OBJECT_SHELL_SIZE + 4 * OBJREF_SIZE)); + // 1.4+ + classesSizes.put("sun.reflect.UnsafeStaticFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticBooleanFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticByteFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticShortFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticIntegerFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticLongFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticCharacterFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticFloatFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticDoubleFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + classesSizes.put("sun.reflect.UnsafeStaticObjectFieldAccessorImpl", Integers.valueOf(OBJECT_SHELL_SIZE));// unknown + // 1.5+ + classesSizes.put("java.lang.Enum", Integers.valueOf(OBJECT_SHELL_SIZE));// not really a pb, but since this is + // shared, so there's no point in going + // further + classesSizes.put("sun.reflect.ConstantPool", Integers.valueOf(OBJECT_SHELL_SIZE + OBJECT_SHELL_SIZE)); + sunProblematicClassesSizes = Collections.unmodifiableMap(classesSizes); + + List classes = new ArrayList(sunProblematicClassesSizes.size()); + Iterator iter = sunProblematicClassesSizes.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + String className = (String) entry.getKey(); + try { + classes.add(Class.forName(className)); + } catch (ClassNotFoundException cnfe) { + // } catch (ExceptionInInitializerError eiie) { + // } catch (NoClassDefFoundError ncdfe) { + // } catch (UnsatisfiedLinkError le) { + } catch (LinkageError le) { + // BEA JRockit 1.4 also throws NoClassDefFoundError and UnsatisfiedLinkError + } + } + sunProblematicClasses = (Class[]) classes.toArray(new Class[0]); + } + + /** + * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5012949 Implementation note: we can compare classes with == + * since they will always be loaded from the same ClassLoader (they are "low" in the hierarchy) + */ + private static int skipClassDueToSunJVMBug(Class clazz) { + for (int i = 0; i < sunProblematicClasses.length; ++i) { + Class sunPbClass = sunProblematicClasses[i]; + if (clazz == sunPbClass) { + return ((Integer) sunProblematicClassesSizes.get(clazz.getName())).intValue(); + } + } + return 0; + } + + /* + * Very very incomplete, but better than nothing... + */ + // See http://download.oracle.com/javase/7/docs/api/constant-values.html for JDK's String constants + private static boolean isSharedFlyweight(Object obj) { + if (obj == null) { + return true; + } + if (obj == Boolean.TRUE || obj == Boolean.FALSE) { + return true; + } + if (/* obj == Locale.ROOT || *//* Java 6 */ + obj == Locale.ENGLISH || obj == Locale.FRENCH || obj == Locale.GERMAN || obj == Locale.ITALIAN + || obj == Locale.JAPANESE || obj == Locale.KOREAN || obj == Locale.CHINESE + || obj == Locale.SIMPLIFIED_CHINESE || obj == Locale.TRADITIONAL_CHINESE || obj == Locale.FRANCE + || obj == Locale.GERMANY || obj == Locale.ITALY || obj == Locale.JAPAN || obj == Locale.KOREA + || obj == Locale.CHINA || obj == Locale.PRC || obj == Locale.TAIWAN || obj == Locale.UK + || obj == Locale.US || obj == Locale.CANADA || obj == Locale.CANADA_FRENCH) { + return true; + } + if (obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP) { + return true; + } + if (obj == BigInteger.ZERO || obj == BigInteger.ONE) { + return true; + } + if (obj == System.in || obj == System.out || obj == System.err) { + return true; + } + if (obj == String.CASE_INSENSITIVE_ORDER) { + return true; + } + if (obj == JarFile.MANIFEST_NAME) { + return true; + } + return false; + } +} + +final class Integers { + + private Integers(){ + } + + private static final int cache_low = -128; + private static final int cache_high = 127; + private static final Integer cache[] = new Integer[(cache_high - cache_low) + 1]; + + static { + for (int i = 0; i < cache.length; ++i) { + cache[i] = new Integer(i + cache_low); + } + } + + /** + * Returns a Integer instance representing the specified int value. If a new Integer + * instance is not required, this method should generally be used in preference to the constructor + * {@link #Integer(int)}, as this method is likely to yield significantly better space and time performance by + * caching frequently requested values. + * + * @param i an int value. + * @return a Integer instance representing i. + * @since 1.5 + */ + public static Integer valueOf(int i) { + if (i >= cache_low && i <= cache_high) { // must cache + return cache[i - cache_low]; + } else { + return new Integer(i); + } + } +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/spring/PropertyPlaceholderConfigurer.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/spring/PropertyPlaceholderConfigurer.java index 47d302e1..221bc5e5 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/spring/PropertyPlaceholderConfigurer.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/spring/PropertyPlaceholderConfigurer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.spring; import java.util.ArrayList; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/test/JTesterxClassPathXmlApplicationContext.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/test/JTesterxClassPathXmlApplicationContext.java index 50aa99b6..404e32fc 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/test/JTesterxClassPathXmlApplicationContext.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/test/JTesterxClassPathXmlApplicationContext.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.test; import java.util.List; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorServiceFactoryBean.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorServiceFactoryBean.java index f7fbdf35..46a77196 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorServiceFactoryBean.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorServiceFactoryBean.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.thread; import java.util.concurrent.ArrayBlockingQueue; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplate.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplate.java index 8fef7289..92847736 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplate.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplate.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.thread; import java.util.ArrayList; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplateGetter.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplateGetter.java index edd51bee..4a9d54c1 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplateGetter.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/ExecutorTemplateGetter.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.thread; import org.springframework.aop.TargetSource; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/NamedThreadFactory.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/NamedThreadFactory.java index 5e922d39..f2b5409c 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/NamedThreadFactory.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/thread/NamedThreadFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.thread; import java.lang.Thread.UncaughtExceptionHandler; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/OtterVersionAnnotation.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/OtterVersionAnnotation.java index 7d92e73a..bb3bb01d 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/OtterVersionAnnotation.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/OtterVersionAnnotation.java @@ -1,59 +1,73 @@ -package com.alibaba.otter.shared.common.utils.version; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A package attribute that captures the version of Otter that was compiled. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.PACKAGE) -public @interface OtterVersionAnnotation { - - /** - * Get the Otter version - * - * @return the version string "3.0.5-r" - */ - String version(); - - /** - * Get the username that compiled Otter. - */ - String user(); - - /** - * Get the date when Otter was compiled. - * - * @return the date in unix 'date' format - */ - String date(); - - /** - * Get the url for the subversion repository. - */ - String url(); - - /** - * Get the subversion revision. - * - * @return the revision number as a string (eg. "168168") - */ - String revision(); - - /** - * Get the branch from which this was compiled. - * - * @return The branch name, e.g. "trunk" or "branches/branch-3.0.5" - */ - String branch(); - - /** - * Get a checksum of the source files from which Otter was compiled. - * - * @return a string that uniquely identifies the source - */ - String srcChecksum(); -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.common.utils.version; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * A package attribute that captures the version of Otter that was compiled. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PACKAGE) +public @interface OtterVersionAnnotation { + + /** + * Get the Otter version + * + * @return the version string "3.0.5-r" + */ + String version(); + + /** + * Get the username that compiled Otter. + */ + String user(); + + /** + * Get the date when Otter was compiled. + * + * @return the date in unix 'date' format + */ + String date(); + + /** + * Get the url for the subversion repository. + */ + String url(); + + /** + * Get the subversion revision. + * + * @return the revision number as a string (eg. "168168") + */ + String revision(); + + /** + * Get the branch from which this was compiled. + * + * @return The branch name, e.g. "trunk" or "branches/branch-3.0.5" + */ + String branch(); + + /** + * Get a checksum of the source files from which Otter was compiled. + * + * @return a string that uniquely identifies the source + */ + String srcChecksum(); +} diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/VersionInfo.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/VersionInfo.java index 7f1c7ffe..499a01dc 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/VersionInfo.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/version/VersionInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.version; import org.apache.commons.lang.SystemUtils; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ByteSerializer.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ByteSerializer.java index bc59baa0..ad3945de 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ByteSerializer.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ByteSerializer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.zookeeper; import java.io.UnsupportedEncodingException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/StringSerializer.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/StringSerializer.java index b7067c30..6d0d1ce1 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/StringSerializer.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/StringSerializer.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.zookeeper; import java.io.UnsupportedEncodingException; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java index 59a0a60e..331fc4ee 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.zookeeper; import java.io.OutputStream; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkEventThread.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkEventThread.java index f9e59604..f8fc1ad2 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkEventThread.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkEventThread.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.zookeeper; import java.util.concurrent.ArrayBlockingQueue; diff --git a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZooKeeperx.java b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZooKeeperx.java index 52624682..feb105e1 100644 --- a/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZooKeeperx.java +++ b/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZooKeeperx.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils.zookeeper; import java.io.IOException; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/AddressUtilsTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/AddressUtilsTest.java index f5e52778..a20064bb 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/AddressUtilsTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/AddressUtilsTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common; import java.net.InetAddress; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterPerformance.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterPerformance.java index e8e4c3db..b4d562e8 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterPerformance.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterPerformance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common; import java.text.MessageFormat; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterTest.java index 4fabb73b..4457b626 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common; import org.jtester.annotations.SpringApplicationContext; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/JsonUtilsTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/JsonUtilsTest.java index c57aaaf4..d4d11022 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/JsonUtilsTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/JsonUtilsTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common; import java.util.Date; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/config/ConfigHelperTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/config/ConfigHelperTest.java index 3f72c04a..2dd856dd 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/config/ConfigHelperTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/config/ConfigHelperTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.config; import org.apache.oro.text.regex.MalformedPatternException; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/JtesterxSampleTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/JtesterxSampleTest.java index 14a6e717..19c76266 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/JtesterxSampleTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/JtesterxSampleTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.sample; import mockit.Mocked; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService1.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService1.java index 34df2668..7a5b5a85 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService1.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService1.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.sample; import org.springframework.beans.factory.InitializingBean; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService2.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService2.java index dd3044ca..f3fd4b1e 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService2.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService2.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.sample; import org.springframework.beans.factory.InitializingBean; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService3.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService3.java index a9897bdd..f07b39e8 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService3.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestMockService3.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.sample; import org.springframework.beans.factory.InitializingBean; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestService.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestService.java index 6afe461c..b2d6374b 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestService.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/sample/TestService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.sample; /** diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/BooleanMutexTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/BooleanMutexTest.java index bb8bc6df..48396b50 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/BooleanMutexTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/BooleanMutexTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.util.concurrent.Callable; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecIntegration.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecIntegration.java index 2cc94344..eb087f07 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecIntegration.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecIntegration.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.File; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecutorTemplateTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecutorTemplateTest.java index 725aacc8..55bc3fe6 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecutorTemplateTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ExecutorTemplateTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import org.apache.commons.lang.math.RandomUtils; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/JavaSourceCompilerTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/JavaSourceCompilerTest.java index a620da83..6c0b433a 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/JavaSourceCompilerTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/JavaSourceCompilerTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.IOException; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsPerformance.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsPerformance.java index 07b25fe7..f71d70c1 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsPerformance.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsPerformance.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.File; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsTest.java index 46a693e6..920fd5d6 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/NioUtilsTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.io.ByteArrayOutputStream; diff --git a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ResourceBundleUtilTest.java b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ResourceBundleUtilTest.java index 39034700..be607915 100644 --- a/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ResourceBundleUtilTest.java +++ b/shared/common/src/test/java/com/alibaba/otter/shared/common/utils/ResourceBundleUtilTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.common.utils; import java.util.MissingResourceException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationClient.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationClient.java index c04484f6..3e044785 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationClient.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationClient.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core; import com.alibaba.otter.shared.communication.core.model.Callback; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationEndpoint.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationEndpoint.java index 8975f3f9..e671e24e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationEndpoint.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationEndpoint.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationRegistry.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationRegistry.java index da27e175..7b30d84e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationRegistry.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/CommunicationRegistry.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core; import java.util.Iterator; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/exception/CommunicationException.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/exception/CommunicationException.java index bed09341..558100c7 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/exception/CommunicationException.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/exception/CommunicationException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.exception; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/AbstractCommunicationEndpoint.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/AbstractCommunicationEndpoint.java index 18792905..00cb6d8c 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/AbstractCommunicationEndpoint.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/AbstractCommunicationEndpoint.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl; import java.lang.reflect.Method; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/DefaultCommunicationClientImpl.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/DefaultCommunicationClientImpl.java index 60148e60..3695d707 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/DefaultCommunicationClientImpl.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/DefaultCommunicationClientImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl; import java.net.InetAddress; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnection.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnection.java index 72a8c845..7eb144e7 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnection.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnection.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.connection; import com.alibaba.otter.shared.communication.core.exception.CommunicationException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionFactory.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionFactory.java index f9973f65..0aa3dfe5 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionFactory.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.connection; import com.alibaba.otter.shared.communication.core.model.CommunicationParam; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolFactory.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolFactory.java index 53f05395..58234c0f 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolFactory.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.connection; import org.apache.commons.pool.impl.GenericKeyedObjectPool; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolable.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolable.java index 63a4740d..ebdca91a 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolable.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolable.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.connection; import com.alibaba.otter.shared.communication.core.exception.CommunicationException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolableFactory.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolableFactory.java index ff7ff634..3eaff76e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolableFactory.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/connection/CommunicationConnectionPoolableFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.connection; import org.apache.commons.pool.KeyedPoolableObjectFactory; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnection.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnection.java index fda68b9b..db9a0ca5 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnection.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnection.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.dubbo; import com.alibaba.otter.shared.communication.core.CommunicationEndpoint; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnectionFactory.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnectionFactory.java index c914b412..97ed348e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnectionFactory.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationConnectionFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.dubbo; import java.text.MessageFormat; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationEndpoint.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationEndpoint.java index 2b3b3b6b..6134653e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationEndpoint.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/dubbo/DubboCommunicationEndpoint.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.dubbo; import java.text.MessageFormat; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationClientImpl.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationClientImpl.java index e9c15d59..69c124b7 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationClientImpl.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationClientImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.rmi; import com.alibaba.otter.shared.communication.core.CommunicationClient; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnection.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnection.java index aa4239e2..5a96548b 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnection.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnection.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.rmi; import com.alibaba.otter.shared.communication.core.CommunicationEndpoint; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnectionFactory.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnectionFactory.java index 88291549..11ef2c2e 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnectionFactory.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationConnectionFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.rmi; import java.text.MessageFormat; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationEndpoint.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationEndpoint.java index b42989fa..78a2ac24 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationEndpoint.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/impl/rmi/RmiCommunicationEndpoint.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.impl.rmi; import java.rmi.RemoteException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Callback.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Callback.java index 4f76f46d..6c4417f9 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Callback.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Callback.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.model; /** diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/CommunicationParam.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/CommunicationParam.java index 67b6ba88..88c3335d 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/CommunicationParam.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/CommunicationParam.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.model; /** diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Event.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Event.java index 1fab6e6f..f44441f3 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Event.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/Event.java @@ -1,35 +1,49 @@ -package com.alibaba.otter.shared.communication.core.model; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * 通讯事件对象 - * - * @author jianghang 2011-9-9 下午04:02:53 - */ -public abstract class Event implements Serializable { - - private static final long serialVersionUID = 208038167977229245L; - - private EventType type; - - protected Event(){ - } - - protected Event(EventType type){ - this.type = type; - } - - public EventType getType() { - return type; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.communication.core.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * 通讯事件对象 + * + * @author jianghang 2011-9-9 下午04:02:53 + */ +public abstract class Event implements Serializable { + + private static final long serialVersionUID = 208038167977229245L; + + private EventType type; + + protected Event(){ + } + + protected Event(EventType type){ + this.type = type; + } + + public EventType getType() { + return type; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/EventType.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/EventType.java index 03a2b76b..332c6dbe 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/EventType.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/EventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.model; /** diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/heart/HeartEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/heart/HeartEvent.java index 4d749a77..a7651283 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/heart/HeartEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/core/model/heart/HeartEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.core.model.heart; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/OtterRemoteException.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/OtterRemoteException.java index d8729fee..b09a22a1 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/OtterRemoteException.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/OtterRemoteException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/ArbitrateEventType.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/ArbitrateEventType.java index a657b702..b938c122 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/ArbitrateEventType.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/ArbitrateEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.arbitrate; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/NodeAlarmEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/NodeAlarmEvent.java index 589d1e5c..7e6612d1 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/NodeAlarmEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/NodeAlarmEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.arbitrate; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StageSingleEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StageSingleEvent.java index 52d41fb1..717d437b 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StageSingleEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StageSingleEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.arbitrate; import com.alibaba.otter.shared.common.model.config.enums.StageType; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopChannelEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopChannelEvent.java index 6ebb8674..63708cfd 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopChannelEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopChannelEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.arbitrate; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopNodeEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopNodeEvent.java index 72a418d4..1fa7b705 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopNodeEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/arbitrate/StopNodeEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.arbitrate; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/CanalEventType.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/CanalEventType.java index 365e5d11..285ea9b4 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/CanalEventType.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/CanalEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.canal; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindCanalEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindCanalEvent.java index 89214d08..339266ff 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindCanalEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindCanalEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.canal; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindFilterEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindFilterEvent.java index c7fcd164..ae1887d7 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindFilterEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/canal/FindFilterEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.canal; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/ConfigEventType.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/ConfigEventType.java index fe08f35b..06a7c043 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/ConfigEventType.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/ConfigEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindChannelEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindChannelEvent.java index 984a5c6e..d7d7172d 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindChannelEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindChannelEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindMediaEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindMediaEvent.java index 3049c820..927cfa25 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindMediaEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindMediaEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindNodeEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindNodeEvent.java index d3ebe68d..6df701c3 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindNodeEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindNodeEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindTaskEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindTaskEvent.java index 5085dff5..b56a7719 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindTaskEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/FindTaskEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyChannelEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyChannelEvent.java index cc4519b8..ae30e5ef 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyChannelEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyChannelEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyMediaEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyMediaEvent.java index 1bb0028f..07670e38 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyMediaEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/config/NotifyMediaEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.config; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/DelayCountEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/DelayCountEvent.java index c2a5d2fa..a6d43493 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/DelayCountEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/DelayCountEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.statistics; import com.alibaba.otter.shared.common.model.statistics.delay.DelayCount; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/StatisticsEventType.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/StatisticsEventType.java index 22b0fcb7..6ecffc2c 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/StatisticsEventType.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/StatisticsEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.statistics; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/TableStatEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/TableStatEvent.java index dc4624dc..cbba2c0d 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/TableStatEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/TableStatEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.statistics; import java.util.List; diff --git a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/ThroughputStatEvent.java b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/ThroughputStatEvent.java index a8b9c3ab..f2842551 100644 --- a/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/ThroughputStatEvent.java +++ b/shared/communication/src/main/java/com/alibaba/otter/shared/communication/model/statistics/ThroughputStatEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.model.statistics; import java.util.List; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/BaseOtterTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/BaseOtterTest.java index 1839cfbb..ec4a64dc 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/BaseOtterTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/BaseOtterTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication; import org.jtester.annotations.SpringApplicationContext; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/CommunicationSpringIntegrateTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/CommunicationSpringIntegrateTest.java index 6c7f542c..c06e287f 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/CommunicationSpringIntegrateTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/CommunicationSpringIntegrateTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication; import org.jtester.annotations.SpringBeanByName; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppService.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppService.java index ba54a7ad..e9218269 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppService.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppService.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app; import com.alibaba.otter.shared.communication.app.event.AppCreateEvent; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppServiceImpl.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppServiceImpl.java index 878c9440..81f6f2c4 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppServiceImpl.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/CommunicationAppServiceImpl.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app; import java.util.Map; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppCreateEvent.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppCreateEvent.java index d3e79212..e4eae6b0 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppCreateEvent.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppCreateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app.event; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppDeleteEvent.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppDeleteEvent.java index 356d8387..b41b1d4d 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppDeleteEvent.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppDeleteEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app.event; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppEventType.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppEventType.java index efd08544..c5004b59 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppEventType.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppEventType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app.event; import com.alibaba.otter.shared.communication.core.model.EventType; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppFindEvent.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppFindEvent.java index 04ff05d3..ca1c769a 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppFindEvent.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppFindEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app.event; import com.alibaba.otter.shared.communication.core.model.Event; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppUpdateEvent.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppUpdateEvent.java index d1c0f820..6c327149 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppUpdateEvent.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/app/event/AppUpdateEvent.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.app.event; import java.io.Serializable; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboCommunicationTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboCommunicationTest.java index d8c188bd..6fd83616 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboCommunicationTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboCommunicationTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.dubbo; import java.math.BigDecimal; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboConnectionTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboConnectionTest.java index 8a057795..14f5450a 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboConnectionTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/dubbo/DubboConnectionTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.dubbo; import org.testng.annotations.BeforeClass; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiCommunicationTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiCommunicationTest.java index a61563f8..12eb1be1 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiCommunicationTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiCommunicationTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.rmi; import java.math.BigDecimal; diff --git a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiConnectionTest.java b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiConnectionTest.java index 47d6a598..bcd28cf4 100644 --- a/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiConnectionTest.java +++ b/shared/communication/src/test/java/com/alibaba/otter/shared/communication/rmi/RmiConnectionTest.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.communication.rmi; import java.util.concurrent.Callable; diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileInfo.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileInfo.java index bc2f9b62..4b0e82f2 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileInfo.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileInfo.java @@ -1,49 +1,63 @@ -package com.alibaba.otter.shared.etl.extend.fileresolver; - -/** - * 文件描述信息 - * - * @version 4.1.0 - */ -public class FileInfo { - - // private File file; - private long lastModifiedTime; - private String namespace; - private String path; - private long size; - - public FileInfo(String path){ - this.namespace = ""; - // this.file = new File(path); - // this.size = file.length(); - // this.lastModifiedTime = file.lastModified(); - this.path = path; - } - - public FileInfo(String namespace, String path){ - this.namespace = namespace; - this.path = path; - } - - public String getNamespace() { - return namespace; - } - - public String getPath() { - return path; - } - - public long getLastModifiedTime() { - return lastModifiedTime; - } - - public long getSize() { - return size; - } - - public String toString() { - return "FileInfo [namespace=" + namespace + ", path=" + path + ", size=" + size + ", modifyTime=" - + lastModifiedTime + "]"; - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.extend.fileresolver; + +/** + * 文件描述信息 + * + * @version 4.1.0 + */ +public class FileInfo { + + // private File file; + private long lastModifiedTime; + private String namespace; + private String path; + private long size; + + public FileInfo(String path){ + this.namespace = ""; + // this.file = new File(path); + // this.size = file.length(); + // this.lastModifiedTime = file.lastModified(); + this.path = path; + } + + public FileInfo(String namespace, String path){ + this.namespace = namespace; + this.path = path; + } + + public String getNamespace() { + return namespace; + } + + public String getPath() { + return path; + } + + public long getLastModifiedTime() { + return lastModifiedTime; + } + + public long getSize() { + return size; + } + + public String toString() { + return "FileInfo [namespace=" + namespace + ", path=" + path + ", size=" + size + ", modifyTime=" + + lastModifiedTime + "]"; + } +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileResolver.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileResolver.java index 6c7b14a0..8086a62b 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileResolver.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/FileResolver.java @@ -1,29 +1,43 @@ -package com.alibaba.otter.shared.etl.extend.fileresolver; - -import java.util.Map; - -/** - * 文件提取接口类,包含附件的业务表需要实现该接口获取记录对应的附件信息. - * - * @author xiaoqing.zhouxq - */ -public interface FileResolver { - - /** - * Get attachment file, the logic: - * - * @param rowMap key=column_name(UpCase) value=column_value - * @return FileInfo[] or null - */ - public FileInfo[] getFileInfo(Map rowMap); - - /** - * 针对数据delete类型是否删除对应文件 - * - * @return - */ - public boolean isDeleteRequired(); - - public boolean isDistributed(); - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.extend.fileresolver; + +import java.util.Map; + +/** + * 文件提取接口类,包含附件的业务表需要实现该接口获取记录对应的附件信息. + * + * @author xiaoqing.zhouxq + */ +public interface FileResolver { + + /** + * Get attachment file, the logic: + * + * @param rowMap key=column_name(UpCase) value=column_value + * @return FileInfo[] or null + */ + public FileInfo[] getFileInfo(Map rowMap); + + /** + * 针对数据delete类型是否删除对应文件 + * + * @return + */ + public boolean isDeleteRequired(); + + public boolean isDistributed(); + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectory.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectory.java index 40053d74..fce24c86 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectory.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.etl.extend.fileresolver.support; import java.io.IOException; diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcher.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcher.java index e8258c19..266b8aa7 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcher.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcher.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.etl.extend.fileresolver.support; /** diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcherAware.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcherAware.java index d5d311c2..20766696 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcherAware.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/fileresolver/support/RemoteDirectoryFetcherAware.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.etl.extend.fileresolver.support; /** diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/processor/EventProcessor.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/processor/EventProcessor.java index 3163b35b..d07af2ce 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/processor/EventProcessor.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/extend/processor/EventProcessor.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.etl.extend.processor; import com.alibaba.otter.shared.etl.model.EventData; diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/BatchObject.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/BatchObject.java index 030a9361..ae74fdf4 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/BatchObject.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/BatchObject.java @@ -1,52 +1,66 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author xiaoqing.zhouxq 2011-8-15 上午09:10:42 - */ -public abstract class BatchObject implements Serializable { - - private static final long serialVersionUID = 3211077130963551303L; - private Identity identity; - - public Identity getIdentity() { - return identity; - } - - public void setIdentity(Identity identity) { - this.identity = identity; - } - - public abstract void merge(T data); - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((identity == null) ? 0 : identity.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - BatchObject other = (BatchObject) obj; - if (identity == null) { - if (other.identity != null) return false; - } else if (!identity.equals(other.identity)) return false; - return true; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author xiaoqing.zhouxq 2011-8-15 上午09:10:42 + */ +public abstract class BatchObject implements Serializable { + + private static final long serialVersionUID = 3211077130963551303L; + private Identity identity; + + public Identity getIdentity() { + return identity; + } + + public void setIdentity(Identity identity) { + this.identity = identity; + } + + public abstract void merge(T data); + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((identity == null) ? 0 : identity.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + BatchObject other = (BatchObject) obj; + if (identity == null) { + if (other.identity != null) return false; + } else if (!identity.equals(other.identity)) return false; + return true; + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/DbBatch.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/DbBatch.java index c49419d2..68315e09 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/DbBatch.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/DbBatch.java @@ -1,68 +1,82 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.File; -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * 基于数据库的同步记录对象 - * - * @author xiaoqing.zhouxq - */ -public class DbBatch implements Serializable { - - private static final long serialVersionUID = 1716704802567430638L; - - private RowBatch rowBatch; // 如果目标端是db,则一定不为空 - - private FileBatch fileBatch; // 可能没有附件 - - private File root; // attachment的根路径,如果存在fileBatch一定存在attachment - - public DbBatch(){ - - } - - public DbBatch(RowBatch rowBatch){ - this.rowBatch = rowBatch; - } - - public DbBatch(RowBatch rowBatch, FileBatch fileBatch, File root){ - this.rowBatch = rowBatch; - this.fileBatch = fileBatch; - this.root = root; - } - - public RowBatch getRowBatch() { - return rowBatch; - } - - public void setRowBatch(RowBatch rowBatch) { - this.rowBatch = rowBatch; - } - - public FileBatch getFileBatch() { - return fileBatch; - } - - public void setFileBatch(FileBatch fileBatch) { - this.fileBatch = fileBatch; - } - - public File getRoot() { - return root; - } - - public void setRoot(File root) { - this.root = root; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.File; +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * 基于数据库的同步记录对象 + * + * @author xiaoqing.zhouxq + */ +public class DbBatch implements Serializable { + + private static final long serialVersionUID = 1716704802567430638L; + + private RowBatch rowBatch; // 如果目标端是db,则一定不为空 + + private FileBatch fileBatch; // 可能没有附件 + + private File root; // attachment的根路径,如果存在fileBatch一定存在attachment + + public DbBatch(){ + + } + + public DbBatch(RowBatch rowBatch){ + this.rowBatch = rowBatch; + } + + public DbBatch(RowBatch rowBatch, FileBatch fileBatch, File root){ + this.rowBatch = rowBatch; + this.fileBatch = fileBatch; + this.root = root; + } + + public RowBatch getRowBatch() { + return rowBatch; + } + + public void setRowBatch(RowBatch rowBatch) { + this.rowBatch = rowBatch; + } + + public FileBatch getFileBatch() { + return fileBatch; + } + + public void setFileBatch(FileBatch fileBatch) { + this.fileBatch = fileBatch; + } + + public File getRoot() { + return root; + } + + public void setRoot(File root) { + this.root = root; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumn.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumn.java index 9947e84e..2940c457 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumn.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumn.java @@ -1,143 +1,157 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * @author xiaoqing.zhouxq 2011-8-10 上午10:42:27 - */ -public class EventColumn implements Serializable { - - private static final long serialVersionUID = 8881024631437131042L; - - private int index; - - private int columnType; - - private String columnName; - - /** - * timestamp,Datetime是一个long型的数字. - */ - private String columnValue; - - private boolean isNull; - - private boolean isKey; - - /** - * 2012.08.09 add by ljh , 新加字段,用于表明是否为真实变更字段,只针对非主键字段有效
- * 因为FileResolver/EventProcessor会需要所有字段数据做分析,但又想保留按需字段同步模式 - * - *
-     * 1. row模式,所有字段均为updated
-     * 2. field模式,通过store/db反查得到的结果,均为updated
-     * 3. 其余场景,根据判断是否变更过,设置updated数据
-     * 
- */ - private boolean isUpdate = true; - - public int getColumnType() { - return columnType; - } - - public void setColumnType(int columnType) { - this.columnType = columnType; - } - - public String getColumnName() { - return columnName; - } - - public void setColumnName(String columnName) { - this.columnName = columnName; - } - - public String getColumnValue() { - if (isNull) { - // 如果为null值,强制设置为null, eromanga主要是走protobuf协议,String值默认为空字符,无法标示为null对象 - columnValue = null; - return null; - } else { - return columnValue; - } - } - - public void setColumnValue(String columnValue) { - this.columnValue = columnValue; - } - - public boolean isNull() { - return isNull; - } - - public void setNull(boolean isNull) { - this.isNull = isNull; - } - - public boolean isKey() { - return isKey; - } - - public void setKey(boolean isKey) { - this.isKey = isKey; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public boolean isUpdate() { - return isUpdate; - } - - public void setUpdate(boolean isUpdate) { - this.isUpdate = isUpdate; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); - result = prime * result + columnType; - result = prime * result + ((columnValue == null) ? 0 : columnValue.hashCode()); - result = prime * result + index; - result = prime * result + (isKey ? 1231 : 1237); - result = prime * result + (isNull ? 1231 : 1237); - result = prime * result + (isUpdate ? 1231 : 1237); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - EventColumn other = (EventColumn) obj; - if (columnName == null) { - if (other.columnName != null) return false; - } else if (!columnName.equals(other.columnName)) return false; - if (columnType != other.columnType) return false; - if (columnValue == null) { - if (other.columnValue != null) return false; - } else if (!columnValue.equals(other.columnValue)) return false; - if (index != other.index) return false; - if (isKey != other.isKey) return false; - if (isNull != other.isNull) return false; - if (isUpdate != other.isUpdate) return false; - return true; - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * @author xiaoqing.zhouxq 2011-8-10 上午10:42:27 + */ +public class EventColumn implements Serializable { + + private static final long serialVersionUID = 8881024631437131042L; + + private int index; + + private int columnType; + + private String columnName; + + /** + * timestamp,Datetime是一个long型的数字. + */ + private String columnValue; + + private boolean isNull; + + private boolean isKey; + + /** + * 2012.08.09 add by ljh , 新加字段,用于表明是否为真实变更字段,只针对非主键字段有效
+ * 因为FileResolver/EventProcessor会需要所有字段数据做分析,但又想保留按需字段同步模式 + * + *
+     * 1. row模式,所有字段均为updated
+     * 2. field模式,通过store/db反查得到的结果,均为updated
+     * 3. 其余场景,根据判断是否变更过,设置updated数据
+     * 
+ */ + private boolean isUpdate = true; + + public int getColumnType() { + return columnType; + } + + public void setColumnType(int columnType) { + this.columnType = columnType; + } + + public String getColumnName() { + return columnName; + } + + public void setColumnName(String columnName) { + this.columnName = columnName; + } + + public String getColumnValue() { + if (isNull) { + // 如果为null值,强制设置为null, eromanga主要是走protobuf协议,String值默认为空字符,无法标示为null对象 + columnValue = null; + return null; + } else { + return columnValue; + } + } + + public void setColumnValue(String columnValue) { + this.columnValue = columnValue; + } + + public boolean isNull() { + return isNull; + } + + public void setNull(boolean isNull) { + this.isNull = isNull; + } + + public boolean isKey() { + return isKey; + } + + public void setKey(boolean isKey) { + this.isKey = isKey; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public boolean isUpdate() { + return isUpdate; + } + + public void setUpdate(boolean isUpdate) { + this.isUpdate = isUpdate; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); + result = prime * result + columnType; + result = prime * result + ((columnValue == null) ? 0 : columnValue.hashCode()); + result = prime * result + index; + result = prime * result + (isKey ? 1231 : 1237); + result = prime * result + (isNull ? 1231 : 1237); + result = prime * result + (isUpdate ? 1231 : 1237); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + EventColumn other = (EventColumn) obj; + if (columnName == null) { + if (other.columnName != null) return false; + } else if (!columnName.equals(other.columnName)) return false; + if (columnType != other.columnType) return false; + if (columnValue == null) { + if (other.columnValue != null) return false; + } else if (!columnValue.equals(other.columnValue)) return false; + if (index != other.index) return false; + if (isKey != other.isKey) return false; + if (isNull != other.isNull) return false; + if (isUpdate != other.isUpdate) return false; + return true; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumnIndexComparable.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumnIndexComparable.java index 75f14dd3..c8d7de73 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumnIndexComparable.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventColumnIndexComparable.java @@ -1,22 +1,36 @@ -package com.alibaba.otter.shared.etl.model; - -import java.util.Comparator; - -/** - * 按照EventColumn的index进行排序. - * - * @author xiaoqing.zhouxq 2012-3-8 上午11:38:25 - */ -public class EventColumnIndexComparable implements Comparator { - - public int compare(EventColumn o1, EventColumn o2) { - if (o1.getIndex() < o2.getIndex()) { - return -1; - } else if (o1.getIndex() == o2.getIndex()) { - return 0; - } else { - return 1; - } - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.util.Comparator; + +/** + * 按照EventColumn的index进行排序. + * + * @author xiaoqing.zhouxq 2012-3-8 上午11:38:25 + */ +public class EventColumnIndexComparable implements Comparator { + + public int compare(EventColumn o1, EventColumn o2) { + if (o1.getIndex() < o2.getIndex()) { + return -1; + } else if (o1.getIndex() == o2.getIndex()) { + return 0; + } else { + return 1; + } + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventData.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventData.java index c473517e..bbcc276f 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventData.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventData.java @@ -1,260 +1,274 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.model.config.channel.ChannelParameter.SyncConsistency; -import com.alibaba.otter.shared.common.model.config.channel.ChannelParameter.SyncMode; -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * 每条变更数据. - * - * @author xiaoqing.zhouxq 2011-8-9 下午03:42:20 - */ -public class EventData implements ObjectData, Serializable { - - private static final long serialVersionUID = -7071677425383765372L; - - /** - * otter内部维护的一套tableId,区别与从eromanga中得到的tableId. - */ - private long tableId = -1; - - private String tableName; - - private String schemaName; - - /** - * 变更数据的业务类型(I/U/D/C/A/E),与ErosaProtocol中定义的EventType一致. - */ - private EventType eventType; - - /** - * 变更数据的业务时间. - */ - private long executeTime; - - /** - * 变更前的主键值,如果是insert/delete变更前和变更后的主键值是一样的. - */ - private List oldKeys = new ArrayList(); - - /** - * 变更后的主键值,如果是insert/delete变更前和变更后的主键值是一样的. - */ - private List keys = new ArrayList(); - - private List columns = new ArrayList(); - - // ====================== 运行过程中对数据的附加属性 ============================= - /** - * 预计的size大小,基于binlog event的推算 - */ - private long size = 1024; - - /** - * 同步映射的id - */ - private long pairId = -1; - - /** - * 当eventType = CREATE/ALTER/ERASE时,就是对应的sql语句,否则无效. - */ - private String sql; - - /** - * 自定义的同步模式, 允许覆盖默认的pipeline parameter,比如针对补救数据同步 - */ - private SyncMode syncMode; - - /** - * 自定义的同步一致性,允许覆盖默认的pipeline parameter,比如针对字段组强制反查数据库 - */ - private SyncConsistency syncConsistency; - - /** - * 是否为remedy补救数据,比如回环补救自动产生的数据,或者是freedom产生的手工订正数据 - */ - private boolean remedy = false; - - public long getTableId() { - return tableId; - } - - public void setTableId(long tableId) { - this.tableId = tableId; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getSchemaName() { - return schemaName; - } - - public void setSchemaName(String schemaName) { - this.schemaName = schemaName; - } - - public EventType getEventType() { - return eventType; - } - - public void setEventType(EventType eventType) { - this.eventType = eventType; - } - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - public long getExecuteTime() { - return executeTime; - } - - public void setExecuteTime(long executeTime) { - this.executeTime = executeTime; - } - - public List getKeys() { - return keys; - } - - public void setKeys(List keys) { - this.keys = keys; - } - - public List getColumns() { - return columns; - } - - public void setColumns(List columns) { - this.columns = columns; - } - - public long getPairId() { - return pairId; - } - - public void setPairId(long pairId) { - this.pairId = pairId; - } - - public List getOldKeys() { - return oldKeys; - } - - public void setOldKeys(List oldKeys) { - this.oldKeys = oldKeys; - } - - public SyncMode getSyncMode() { - return syncMode; - } - - public void setSyncMode(SyncMode syncMode) { - this.syncMode = syncMode; - } - - public SyncConsistency getSyncConsistency() { - return syncConsistency; - } - - public void setSyncConsistency(SyncConsistency syncConsistency) { - this.syncConsistency = syncConsistency; - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - public boolean isRemedy() { - return remedy; - } - - public void setRemedy(boolean remedy) { - this.remedy = remedy; - } - - // ======================== helper method ================= - - /** - * 返回所有待变更的字段 - */ - public List getUpdatedColumns() { - List columns = new ArrayList(); - for (EventColumn column : this.columns) { - if (column.isUpdate()) { - columns.add(column); - } - } - - return columns; - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((columns == null) ? 0 : columns.hashCode()); - result = prime * result + ((eventType == null) ? 0 : eventType.hashCode()); - result = prime * result + (int) (executeTime ^ (executeTime >>> 32)); - result = prime * result + ((keys == null) ? 0 : keys.hashCode()); - result = prime * result + ((oldKeys == null) ? 0 : oldKeys.hashCode()); - result = prime * result + (int) (pairId ^ (pairId >>> 32)); - result = prime * result + ((schemaName == null) ? 0 : schemaName.hashCode()); - result = prime * result + (int) (tableId ^ (tableId >>> 32)); - result = prime * result + ((tableName == null) ? 0 : tableName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - EventData other = (EventData) obj; - if (columns == null) { - if (other.columns != null) return false; - } else if (!columns.equals(other.columns)) return false; - if (eventType != other.eventType) return false; - if (executeTime != other.executeTime) return false; - if (keys == null) { - if (other.keys != null) return false; - } else if (!keys.equals(other.keys)) return false; - if (oldKeys == null) { - if (other.oldKeys != null) return false; - } else if (!oldKeys.equals(other.oldKeys)) return false; - if (pairId != other.pairId) return false; - if (schemaName == null) { - if (other.schemaName != null) return false; - } else if (!schemaName.equals(other.schemaName)) return false; - if (tableId != other.tableId) return false; - if (tableName == null) { - if (other.tableName != null) return false; - } else if (!tableName.equals(other.tableName)) return false; - return true; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.model.config.channel.ChannelParameter.SyncConsistency; +import com.alibaba.otter.shared.common.model.config.channel.ChannelParameter.SyncMode; +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * 每条变更数据. + * + * @author xiaoqing.zhouxq 2011-8-9 下午03:42:20 + */ +public class EventData implements ObjectData, Serializable { + + private static final long serialVersionUID = -7071677425383765372L; + + /** + * otter内部维护的一套tableId,区别与从eromanga中得到的tableId. + */ + private long tableId = -1; + + private String tableName; + + private String schemaName; + + /** + * 变更数据的业务类型(I/U/D/C/A/E),与ErosaProtocol中定义的EventType一致. + */ + private EventType eventType; + + /** + * 变更数据的业务时间. + */ + private long executeTime; + + /** + * 变更前的主键值,如果是insert/delete变更前和变更后的主键值是一样的. + */ + private List oldKeys = new ArrayList(); + + /** + * 变更后的主键值,如果是insert/delete变更前和变更后的主键值是一样的. + */ + private List keys = new ArrayList(); + + private List columns = new ArrayList(); + + // ====================== 运行过程中对数据的附加属性 ============================= + /** + * 预计的size大小,基于binlog event的推算 + */ + private long size = 1024; + + /** + * 同步映射的id + */ + private long pairId = -1; + + /** + * 当eventType = CREATE/ALTER/ERASE时,就是对应的sql语句,否则无效. + */ + private String sql; + + /** + * 自定义的同步模式, 允许覆盖默认的pipeline parameter,比如针对补救数据同步 + */ + private SyncMode syncMode; + + /** + * 自定义的同步一致性,允许覆盖默认的pipeline parameter,比如针对字段组强制反查数据库 + */ + private SyncConsistency syncConsistency; + + /** + * 是否为remedy补救数据,比如回环补救自动产生的数据,或者是freedom产生的手工订正数据 + */ + private boolean remedy = false; + + public long getTableId() { + return tableId; + } + + public void setTableId(long tableId) { + this.tableId = tableId; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + + public EventType getEventType() { + return eventType; + } + + public void setEventType(EventType eventType) { + this.eventType = eventType; + } + + public String getSql() { + return sql; + } + + public void setSql(String sql) { + this.sql = sql; + } + + public long getExecuteTime() { + return executeTime; + } + + public void setExecuteTime(long executeTime) { + this.executeTime = executeTime; + } + + public List getKeys() { + return keys; + } + + public void setKeys(List keys) { + this.keys = keys; + } + + public List getColumns() { + return columns; + } + + public void setColumns(List columns) { + this.columns = columns; + } + + public long getPairId() { + return pairId; + } + + public void setPairId(long pairId) { + this.pairId = pairId; + } + + public List getOldKeys() { + return oldKeys; + } + + public void setOldKeys(List oldKeys) { + this.oldKeys = oldKeys; + } + + public SyncMode getSyncMode() { + return syncMode; + } + + public void setSyncMode(SyncMode syncMode) { + this.syncMode = syncMode; + } + + public SyncConsistency getSyncConsistency() { + return syncConsistency; + } + + public void setSyncConsistency(SyncConsistency syncConsistency) { + this.syncConsistency = syncConsistency; + } + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public boolean isRemedy() { + return remedy; + } + + public void setRemedy(boolean remedy) { + this.remedy = remedy; + } + + // ======================== helper method ================= + + /** + * 返回所有待变更的字段 + */ + public List getUpdatedColumns() { + List columns = new ArrayList(); + for (EventColumn column : this.columns) { + if (column.isUpdate()) { + columns.add(column); + } + } + + return columns; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((columns == null) ? 0 : columns.hashCode()); + result = prime * result + ((eventType == null) ? 0 : eventType.hashCode()); + result = prime * result + (int) (executeTime ^ (executeTime >>> 32)); + result = prime * result + ((keys == null) ? 0 : keys.hashCode()); + result = prime * result + ((oldKeys == null) ? 0 : oldKeys.hashCode()); + result = prime * result + (int) (pairId ^ (pairId >>> 32)); + result = prime * result + ((schemaName == null) ? 0 : schemaName.hashCode()); + result = prime * result + (int) (tableId ^ (tableId >>> 32)); + result = prime * result + ((tableName == null) ? 0 : tableName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + EventData other = (EventData) obj; + if (columns == null) { + if (other.columns != null) return false; + } else if (!columns.equals(other.columns)) return false; + if (eventType != other.eventType) return false; + if (executeTime != other.executeTime) return false; + if (keys == null) { + if (other.keys != null) return false; + } else if (!keys.equals(other.keys)) return false; + if (oldKeys == null) { + if (other.oldKeys != null) return false; + } else if (!oldKeys.equals(other.oldKeys)) return false; + if (pairId != other.pairId) return false; + if (schemaName == null) { + if (other.schemaName != null) return false; + } else if (!schemaName.equals(other.schemaName)) return false; + if (tableId != other.tableId) return false; + if (tableName == null) { + if (other.tableName != null) return false; + } else if (!tableName.equals(other.tableName)) return false; + return true; + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventType.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventType.java index a841effd..1e8a2c79 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventType.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/EventType.java @@ -1,97 +1,111 @@ -package com.alibaba.otter.shared.etl.model; - -/** - * chang the eventtype num to I/U/D/C/A/E. - * - * @author xiaoqing.zhouxq 2010-7-22 下午02:47:44 - */ -public enum EventType { - - /** - * Insert row. - */ - INSERT("I"), - - /** - * Update row. - */ - UPDATE("U"), - - /** - * Delete row. - */ - DELETE("D"), - - /** - * Create table. - */ - CREATE("C"), - - /** - * Alter table. - */ - ALTER("A"), - - /** - * Erase table. - */ - ERASE("E"), - - /** - * Query. - */ - QUERY("Q"); - - private String value; - - private EventType(String value){ - this.value = value; - } - - public boolean isInsert() { - return this.equals(EventType.INSERT); - } - - public boolean isUpdate() { - return this.equals(EventType.UPDATE); - } - - public boolean isDelete() { - return this.equals(EventType.DELETE); - } - - public boolean isCreate() { - return this.equals(EventType.CREATE); - } - - public boolean isAlter() { - return this.equals(EventType.ALTER); - } - - public boolean isErase() { - return this.equals(EventType.ERASE); - } - - public boolean isQuery() { - return this.equals(EventType.QUERY); - } - - public static EventType valuesOf(String value) { - EventType[] eventTypes = values(); - for (EventType eventType : eventTypes) { - if (eventType.value.equalsIgnoreCase(value)) { - return eventType; - } - } - return null; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +/** + * chang the eventtype num to I/U/D/C/A/E. + * + * @author xiaoqing.zhouxq 2010-7-22 下午02:47:44 + */ +public enum EventType { + + /** + * Insert row. + */ + INSERT("I"), + + /** + * Update row. + */ + UPDATE("U"), + + /** + * Delete row. + */ + DELETE("D"), + + /** + * Create table. + */ + CREATE("C"), + + /** + * Alter table. + */ + ALTER("A"), + + /** + * Erase table. + */ + ERASE("E"), + + /** + * Query. + */ + QUERY("Q"); + + private String value; + + private EventType(String value){ + this.value = value; + } + + public boolean isInsert() { + return this.equals(EventType.INSERT); + } + + public boolean isUpdate() { + return this.equals(EventType.UPDATE); + } + + public boolean isDelete() { + return this.equals(EventType.DELETE); + } + + public boolean isCreate() { + return this.equals(EventType.CREATE); + } + + public boolean isAlter() { + return this.equals(EventType.ALTER); + } + + public boolean isErase() { + return this.equals(EventType.ERASE); + } + + public boolean isQuery() { + return this.equals(EventType.QUERY); + } + + public static EventType valuesOf(String value) { + EventType[] eventTypes = values(); + for (EventType eventType : eventTypes) { + if (eventType.value.equalsIgnoreCase(value)) { + return eventType; + } + } + return null; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileBatch.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileBatch.java index 97c01672..1e104866 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileBatch.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileBatch.java @@ -1,29 +1,43 @@ -package com.alibaba.otter.shared.etl.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * 文件数据集合对象 - * - * @author jianghang 2012-10-31 下午05:56:01 - * @version 4.1.2 - */ -public class FileBatch extends BatchObject { - - private static final long serialVersionUID = -520456006652566067L; - private List files = new ArrayList(); - - public List getFiles() { - return files; - } - - public void setFiles(List files) { - this.files = files; - } - - public void merge(FileData data) { - this.files.add(data); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * 文件数据集合对象 + * + * @author jianghang 2012-10-31 下午05:56:01 + * @version 4.1.2 + */ +public class FileBatch extends BatchObject { + + private static final long serialVersionUID = -520456006652566067L; + private List files = new ArrayList(); + + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + public void merge(FileData data) { + this.files.add(data); + } + +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileData.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileData.java index 0b5f31c2..8e236c2e 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileData.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/FileData.java @@ -1,130 +1,144 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * 每条变更数据关联的文件信息. - * - * @author xiaoqing.zhouxq 2011-8-9 下午04:52:10 - */ -public class FileData implements ObjectData, Serializable { - - private static final long serialVersionUID = -8758520351171874888L; - - /** - * Aranda use. - */ - private String nameSpace; - - private String path; - - private long size; - - private long lastModifiedTime; - - private long tableId; - - private long pairId; - - private EventType eventType; - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - public long getTableId() { - return tableId; - } - - public void setTableId(long tableId) { - this.tableId = tableId; - } - - public long getLastModifiedTime() { - return lastModifiedTime; - } - - public void setLastModifiedTime(long lastModifiedTime) { - this.lastModifiedTime = lastModifiedTime; - } - - public EventType getEventType() { - return eventType; - } - - public void setEventType(EventType eventType) { - this.eventType = eventType; - } - - public String getNameSpace() { - return nameSpace; - } - - public void setNameSpace(String nameSpace) { - this.nameSpace = nameSpace; - } - - public long getPairId() { - return pairId; - } - - public void setPairId(long pairId) { - this.pairId = pairId; - } - - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - return result; - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof FileData)) { - return false; - } - FileData other = (FileData) obj; - if (nameSpace == null) { - if (other.nameSpace != null) { - return false; - } - } else if (!nameSpace.equals(other.nameSpace)) { - return false; - } - if (path == null) { - if (other.path != null) { - return false; - } - } else if (!path.equals(other.path)) { - return false; - } - return true; - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * 每条变更数据关联的文件信息. + * + * @author xiaoqing.zhouxq 2011-8-9 下午04:52:10 + */ +public class FileData implements ObjectData, Serializable { + + private static final long serialVersionUID = -8758520351171874888L; + + /** + * Aranda use. + */ + private String nameSpace; + + private String path; + + private long size; + + private long lastModifiedTime; + + private long tableId; + + private long pairId; + + private EventType eventType; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public long getTableId() { + return tableId; + } + + public void setTableId(long tableId) { + this.tableId = tableId; + } + + public long getLastModifiedTime() { + return lastModifiedTime; + } + + public void setLastModifiedTime(long lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + } + + public EventType getEventType() { + return eventType; + } + + public void setEventType(EventType eventType) { + this.eventType = eventType; + } + + public String getNameSpace() { + return nameSpace; + } + + public void setNameSpace(String nameSpace) { + this.nameSpace = nameSpace; + } + + public long getPairId() { + return pairId; + } + + public void setPairId(long pairId) { + this.pairId = pairId; + } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof FileData)) { + return false; + } + FileData other = (FileData) obj; + if (nameSpace == null) { + if (other.nameSpace != null) { + return false; + } + } else if (!nameSpace.equals(other.nameSpace)) { + return false; + } + if (path == null) { + if (other.path != null) { + return false; + } + } else if (!path.equals(other.path)) { + return false; + } + return true; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/Identity.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/Identity.java index 8cd1f7ac..0d040fae 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/Identity.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/Identity.java @@ -1,95 +1,109 @@ -package com.alibaba.otter.shared.etl.model; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.alibaba.otter.shared.common.utils.OtterToStringStyle; - -/** - * process标识,用于区分每个process. - * - * @author xiaoqing.zhouxq 2011-8-9 上午10:49:14 - */ -public class Identity implements Serializable { - - private static final long serialVersionUID = -4551215214079451994L; - - private long channelId; - - private long pipelineId; - - private long processId; - - public Identity(){ - - } - - public Identity(Long channelId, Long pipelineId, Long processId){ - this.channelId = channelId; - this.pipelineId = pipelineId; - this.processId = processId; - } - - public long getChannelId() { - return channelId; - } - - public void setChannelId(long channelId) { - this.channelId = channelId; - } - - public long getPipelineId() { - return pipelineId; - } - - public void setPipelineId(long pipelineId) { - this.pipelineId = pipelineId; - } - - public long getProcessId() { - return processId; - } - - public void setProcessId(long processId) { - this.processId = processId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (int) (channelId ^ (channelId >>> 32)); - result = prime * result + (int) (pipelineId ^ (pipelineId >>> 32)); - result = prime * result + (int) (processId ^ (processId >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof Identity)) { - return false; - } - Identity other = (Identity) obj; - if (channelId != other.channelId) { - return false; - } - if (pipelineId != other.pipelineId) { - return false; - } - if (processId != other.processId) { - return false; - } - return true; - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); - } -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.ToStringBuilder; + +import com.alibaba.otter.shared.common.utils.OtterToStringStyle; + +/** + * process标识,用于区分每个process. + * + * @author xiaoqing.zhouxq 2011-8-9 上午10:49:14 + */ +public class Identity implements Serializable { + + private static final long serialVersionUID = -4551215214079451994L; + + private long channelId; + + private long pipelineId; + + private long processId; + + public Identity(){ + + } + + public Identity(Long channelId, Long pipelineId, Long processId){ + this.channelId = channelId; + this.pipelineId = pipelineId; + this.processId = processId; + } + + public long getChannelId() { + return channelId; + } + + public void setChannelId(long channelId) { + this.channelId = channelId; + } + + public long getPipelineId() { + return pipelineId; + } + + public void setPipelineId(long pipelineId) { + this.pipelineId = pipelineId; + } + + public long getProcessId() { + return processId; + } + + public void setProcessId(long processId) { + this.processId = processId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (channelId ^ (channelId >>> 32)); + result = prime * result + (int) (pipelineId ^ (pipelineId >>> 32)); + result = prime * result + (int) (processId ^ (processId >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Identity)) { + return false; + } + Identity other = (Identity) obj; + if (channelId != other.channelId) { + return false; + } + if (pipelineId != other.pipelineId) { + return false; + } + if (processId != other.processId) { + return false; + } + return true; + } + + public String toString() { + return ToStringBuilder.reflectionToString(this, OtterToStringStyle.DEFAULT_STYLE); + } +} diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/ObjectData.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/ObjectData.java index 81175778..255ebc87 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/ObjectData.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/ObjectData.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.shared.etl.model; /** diff --git a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/RowBatch.java b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/RowBatch.java index 11ec7db6..6eb0e7e0 100644 --- a/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/RowBatch.java +++ b/shared/etl/src/main/java/com/alibaba/otter/shared/etl/model/RowBatch.java @@ -1,30 +1,44 @@ -package com.alibaba.otter.shared.etl.model; - -import java.util.LinkedList; -import java.util.List; - -/** - * 数据记录集合对象 - * - * @author jianghang 2012-10-31 下午05:51:42 - * @version 4.1.2 - */ -public class RowBatch extends BatchObject { - - private static final long serialVersionUID = -6117067964148581257L; - - private List datas = new LinkedList(); - - public List getDatas() { - return datas; - } - - public void setDatas(List datas) { - this.datas = datas; - } - - public void merge(EventData data) { - this.datas.add(data); - } - -} +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.alibaba.otter.shared.etl.model; + +import java.util.LinkedList; +import java.util.List; + +/** + * 数据记录集合对象 + * + * @author jianghang 2012-10-31 下午05:51:42 + * @version 4.1.2 + */ +public class RowBatch extends BatchObject { + + private static final long serialVersionUID = -6117067964148581257L; + + private List datas = new LinkedList(); + + public List getDatas() { + return datas; + } + + public void setDatas(List datas) { + this.datas = datas; + } + + public void merge(EventData data) { + this.datas.add(data); + } + +} diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/AbstractSubscribeManager.java b/shared/push/src/main/java/com/alibaba/otter/common/push/AbstractSubscribeManager.java index 1102989b..428b92da 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/AbstractSubscribeManager.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/AbstractSubscribeManager.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; import java.util.Set; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/PushException.java b/shared/push/src/main/java/com/alibaba/otter/common/push/PushException.java index 7e9efe1c..a8e1cac5 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/PushException.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/PushException.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; import org.apache.commons.lang.exception.NestableRuntimeException; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeCallback.java b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeCallback.java index c4c345f4..f63dd1f6 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeCallback.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeCallback.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManager.java b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManager.java index e8a1b618..fccb08e2 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManager.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManager.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManagerFactory.java b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManagerFactory.java index 63c94c80..2c831d09 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManagerFactory.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeManagerFactory.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; import java.util.Map; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeType.java b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeType.java index 6efc6b85..27fc2faf 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeType.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/SubscribeType.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceHanlder.java b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceHanlder.java index bb369e4a..05df4ad5 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceHanlder.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceHanlder.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.datasource; import javax.sql.DataSource; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceKey.java b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceKey.java index 52ef030b..9fa5a147 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceKey.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/DataSourceKey.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.datasource; import com.alibaba.otter.shared.common.model.config.data.DataMediaType; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSource.java b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSource.java index 01a371f9..40fbdb44 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSource.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSource.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.datasource.media; import java.io.PrintWriter; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSourceHandler.java b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSourceHandler.java index d0bd8c34..d4017de0 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSourceHandler.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/datasource/media/MediaPushDataSourceHandler.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.datasource.media; import java.sql.SQLException; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/media/MediaSubscribeManager.java b/shared/push/src/main/java/com/alibaba/otter/common/push/media/MediaSubscribeManager.java index b478dd3e..b35dc93f 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/media/MediaSubscribeManager.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/media/MediaSubscribeManager.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.media; import java.util.Map; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/AbstractDatasourceSupplier.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/AbstractDatasourceSupplier.java index 24c9bf44..b3492a9f 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/AbstractDatasourceSupplier.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/AbstractDatasourceSupplier.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceChangeCallback.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceChangeCallback.java index 7495a13c..c2817430 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceChangeCallback.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceChangeCallback.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceInfo.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceInfo.java index 4bfaf8f7..96d2cefb 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceInfo.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier; import java.net.InetSocketAddress; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceSupplier.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceSupplier.java index 08f342e0..ee928851 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceSupplier.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/DatasourceSupplier.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier; /** diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/HaDatasourceInfo.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/HaDatasourceInfo.java index 8444aded..bc6dfc7f 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/HaDatasourceInfo.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/HaDatasourceInfo.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier; import java.util.ArrayList; diff --git a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/media/MediaDatasourceSupplier.java b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/media/MediaDatasourceSupplier.java index 743bc2ce..6c1cdad3 100644 --- a/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/media/MediaDatasourceSupplier.java +++ b/shared/push/src/main/java/com/alibaba/otter/common/push/supplier/media/MediaDatasourceSupplier.java @@ -1,3 +1,17 @@ +/* + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + package com.alibaba.otter.common.push.supplier.media; import java.net.InetSocketAddress;